mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-07 18:05:21 +02:00
drm/amd/pm: fix error flow in sensor fetching
[ Upstream commit a560085316
]
Sensor fetching functions should return an signed int to
handle errors properly.
Reviewed-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reported-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
c3254bc09f
commit
51e4630ef0
|
@ -1471,9 +1471,9 @@ static ssize_t amdgpu_set_pp_power_profile_mode(struct device *dev,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int amdgpu_hwmon_get_sensor_generic(struct amdgpu_device *adev,
|
static int amdgpu_hwmon_get_sensor_generic(struct amdgpu_device *adev,
|
||||||
enum amd_pp_sensors sensor,
|
enum amd_pp_sensors sensor,
|
||||||
void *query)
|
void *query)
|
||||||
{
|
{
|
||||||
int r, size = sizeof(uint32_t);
|
int r, size = sizeof(uint32_t);
|
||||||
|
|
||||||
|
@ -2787,8 +2787,8 @@ static ssize_t amdgpu_hwmon_show_vddnb_label(struct device *dev,
|
||||||
return sysfs_emit(buf, "vddnb\n");
|
return sysfs_emit(buf, "vddnb\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int amdgpu_hwmon_get_power(struct device *dev,
|
static int amdgpu_hwmon_get_power(struct device *dev,
|
||||||
enum amd_pp_sensors sensor)
|
enum amd_pp_sensors sensor)
|
||||||
{
|
{
|
||||||
struct amdgpu_device *adev = dev_get_drvdata(dev);
|
struct amdgpu_device *adev = dev_get_drvdata(dev);
|
||||||
unsigned int uw;
|
unsigned int uw;
|
||||||
|
@ -2809,7 +2809,7 @@ static ssize_t amdgpu_hwmon_show_power_avg(struct device *dev,
|
||||||
struct device_attribute *attr,
|
struct device_attribute *attr,
|
||||||
char *buf)
|
char *buf)
|
||||||
{
|
{
|
||||||
unsigned int val;
|
int val;
|
||||||
|
|
||||||
val = amdgpu_hwmon_get_power(dev, AMDGPU_PP_SENSOR_GPU_AVG_POWER);
|
val = amdgpu_hwmon_get_power(dev, AMDGPU_PP_SENSOR_GPU_AVG_POWER);
|
||||||
if (val < 0)
|
if (val < 0)
|
||||||
|
@ -2822,7 +2822,7 @@ static ssize_t amdgpu_hwmon_show_power_input(struct device *dev,
|
||||||
struct device_attribute *attr,
|
struct device_attribute *attr,
|
||||||
char *buf)
|
char *buf)
|
||||||
{
|
{
|
||||||
unsigned int val;
|
int val;
|
||||||
|
|
||||||
val = amdgpu_hwmon_get_power(dev, AMDGPU_PP_SENSOR_GPU_INPUT_POWER);
|
val = amdgpu_hwmon_get_power(dev, AMDGPU_PP_SENSOR_GPU_INPUT_POWER);
|
||||||
if (val < 0)
|
if (val < 0)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user