drm/amd/powerplay: fix a couple locking issues
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 3 Apr 2017 18:42:42 +0000 (21:42 +0300)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 4 Apr 2017 17:40:34 +0000 (13:40 -0400)
We should return unlock on the error path in pp_dpm_dispatch_tasks()
and there is a double lock bug in pp_dpm_set_sclk_od().

Fixes: 2a5071056e6a ("drm/amd/powerplay: add global PowerPlay mutex.")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/powerplay/amd_powerplay.c

index 07dbeb225df75061c48b678a2107b213c8d14af6..9da5b0bb66d874bb72412544d5f4410e02a3e0d3 100644 (file)
@@ -493,8 +493,10 @@ static int pp_dpm_dispatch_tasks(void *handle, enum amd_pp_event event_id,
        {
                enum amd_pm_state_type  ps;
 
-               if (input == NULL)
-                       return -EINVAL;
+               if (input == NULL) {
+                       ret = -EINVAL;
+                       break;
+               }
                ps = *(unsigned long *)input;
 
                data.requested_ui_label = power_state_convert(ps);