]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/amdgpu/pm: fix SmartShift bias sysfs store PM refcount on parse error
authorCandice Li <candice.li@amd.com>
Mon, 18 May 2026 11:58:10 +0000 (19:58 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 3 Jun 2026 17:52:52 +0000 (13:52 -0400)
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>
drivers/gpu/drm/amd/pm/amdgpu_pm.c

index ffb03c51a414296bdb886bcf540b325e68895fda..52e5cbcac35296d01ec648849d0c64058e0cb553 100644 (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,