drm/amdgpu/pm: fix SmartShift bias sysfs store PM refcount on parse error

Return the parse error before acquiring PM access.

Signed-off-by: Candice Li <candice.li@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Candice Li 2026-05-18 19:58:10 +08:00 committed by Alex Deucher
parent d288e4ba09
commit a4b0c3f5d2

View File

@ -1886,12 +1886,12 @@ static ssize_t amdgpu_set_smartshift_bias(struct device *dev,
{
struct drm_device *ddev = dev_get_drvdata(dev);
struct amdgpu_device *adev = drm_to_adev(ddev);
int r = 0;
int r;
int bias = 0;
r = kstrtoint(buf, 10, &bias);
if (r)
goto out;
return r;
r = amdgpu_pm_get_access(adev);
if (r < 0)
@ -1903,14 +1903,12 @@ static ssize_t amdgpu_set_smartshift_bias(struct device *dev,
bias = AMDGPU_SMARTSHIFT_MIN_BIAS;
amdgpu_smartshift_bias = bias;
r = count;
/* TODO: update bias level with SMU message */
out:
amdgpu_pm_put_access(adev);
return r;
return count;
}
static int ss_power_attr_update(struct amdgpu_device *adev, struct amdgpu_device_attr *attr,