Return the parse error before acquiring PM access.

Signed-off-by: Candice Li <[email protected]>
---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c 
b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
index 0c58d23013f41f..8140bc77591c3e 100644
--- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
@@ -1862,12 +1862,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)
@@ -1879,14 +1879,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,
-- 
2.25.1

Reply via email to