From: Srinivasan Shanmugam Date: Wed, 23 Aug 2023 01:33:32 +0000 (+0530) Subject: drm/amd/pm: Fixes incorrect type in 'amdgpu_hwmon_show_power_avg() & _input()' X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=d1090194cb4b4bf7f4cfe01f85367580b19e50f6;p=linux.git drm/amd/pm: Fixes incorrect type in 'amdgpu_hwmon_show_power_avg() & _input()' The val is defined as unsigned int type, if(val<0) is invalid, hence modified its type to ssize_t Fixes the below: drivers/gpu/drm/amd/pm/amdgpu_pm.c:2800:5-8: WARNING: Unsigned expression compared with zero: val < 0 drivers/gpu/drm/amd/pm/amdgpu_pm.c:2813:5-8: WARNING: Unsigned expression compared with zero: val < 0 Cc: Guchun Chen Cc: Christian König Cc: Alex Deucher Cc: "Pan, Xinhui" Signed-off-by: Srinivasan Shanmugam Reviewed-by: Asad Kamal Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c b/drivers/gpu/drm/amd/pm/amdgpu_pm.c index 5b1efd9a0e3ad..1da7ece4c6279 100644 --- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c +++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c @@ -2794,26 +2794,26 @@ static ssize_t amdgpu_hwmon_show_power_avg(struct device *dev, struct device_attribute *attr, char *buf) { - int val; + ssize_t val; val = amdgpu_hwmon_get_power(dev, AMDGPU_PP_SENSOR_GPU_AVG_POWER); if (val < 0) return val; - return sysfs_emit(buf, "%u\n", val); + return sysfs_emit(buf, "%zd\n", val); } static ssize_t amdgpu_hwmon_show_power_input(struct device *dev, struct device_attribute *attr, char *buf) { - int val; + ssize_t val; val = amdgpu_hwmon_get_power(dev, AMDGPU_PP_SENSOR_GPU_INPUT_POWER); if (val < 0) return val; - return sysfs_emit(buf, "%u\n", val); + return sysfs_emit(buf, "%zd\n", val); } static ssize_t amdgpu_hwmon_show_power_cap_min(struct device *dev,