summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2024-08-30 03:49:13 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2024-08-30 03:49:13 +0000
commite93289688d0ed175bbc5ae31ade55d20725a4a85 (patch)
tree706158cd403dcefe08d199aa6354d6d568d39b0c
parent5be199ee305f6c477cd41cf1cd81ffe705623105 (diff)
drm/amd/pm: fix error flow in sensor fetching
From Alex Deucher 51e4630ef0d19ad7638762f06e1351c5dcc0c420 in linux-6.6.y/6.6.48 a5600853167aeba5cade81f184a382a0d1b14641 in mainline linux
-rw-r--r--sys/dev/pci/drm/amd/pm/amdgpu_pm.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/dev/pci/drm/amd/pm/amdgpu_pm.c b/sys/dev/pci/drm/amd/pm/amdgpu_pm.c
index 842a5929766..aeffed6af27 100644
--- a/sys/dev/pci/drm/amd/pm/amdgpu_pm.c
+++ b/sys/dev/pci/drm/amd/pm/amdgpu_pm.c
@@ -1473,9 +1473,9 @@ static ssize_t amdgpu_set_pp_power_profile_mode(struct device *dev,
return -EINVAL;
}
-static unsigned int amdgpu_hwmon_get_sensor_generic(struct amdgpu_device *adev,
- enum amd_pp_sensors sensor,
- void *query)
+static int amdgpu_hwmon_get_sensor_generic(struct amdgpu_device *adev,
+ enum amd_pp_sensors sensor,
+ void *query)
{
int r, size = sizeof(uint32_t);
@@ -2789,8 +2789,8 @@ static ssize_t amdgpu_hwmon_show_vddnb_label(struct device *dev,
return sysfs_emit(buf, "vddnb\n");
}
-static unsigned int amdgpu_hwmon_get_power(struct device *dev,
- enum amd_pp_sensors sensor)
+static int amdgpu_hwmon_get_power(struct device *dev,
+ enum amd_pp_sensors sensor)
{
struct amdgpu_device *adev = dev_get_drvdata(dev);
unsigned int uw;
@@ -2811,7 +2811,7 @@ static ssize_t amdgpu_hwmon_show_power_avg(struct device *dev,
struct device_attribute *attr,
char *buf)
{
- unsigned int val;
+ int val;
val = amdgpu_hwmon_get_power(dev, AMDGPU_PP_SENSOR_GPU_AVG_POWER);
if (val < 0)
@@ -2824,7 +2824,7 @@ static ssize_t amdgpu_hwmon_show_power_input(struct device *dev,
struct device_attribute *attr,
char *buf)
{
- unsigned int val;
+ int val;
val = amdgpu_hwmon_get_power(dev, AMDGPU_PP_SENSOR_GPU_INPUT_POWER);
if (val < 0)