drm/amd/powerplay: rewrite pp_sw_init to make code readable
authorHuang Rui <ray.huang@amd.com>
Mon, 9 May 2016 09:29:41 +0000 (17:29 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 11 May 2016 17:30:33 +0000 (13:30 -0400)
Actually, pp_sw_init executes pptable_init and backend_init orderly if
they are initialized successfully. So rewrite it to make code more
readable.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/powerplay/amd_powerplay.c

index 9f2d4069a5f33f2f333607fb8c0e89e265bac5a4..8e345bfddb693033d08584d1093f254ef9619a38 100644 (file)
@@ -68,15 +68,18 @@ static int pp_sw_init(void *handle)
                return -EINVAL;
 
        ret = hwmgr->pptable_func->pptable_init(hwmgr);
+       if (ret)
+               goto err;
 
-       if (ret == 0)
-               ret = hwmgr->hwmgr_func->backend_init(hwmgr);
-
+       ret = hwmgr->hwmgr_func->backend_init(hwmgr);
        if (ret)
-               printk(KERN_ERR "amdgpu: powerplay initialization failed\n");
-       else
-               printk(KERN_INFO "amdgpu: powerplay initialized\n");
+               goto err;
 
+       pr_info("amdgpu: powerplay initialized\n");
+
+       return 0;
+err:
+       pr_err("amdgpu: powerplay initialization failed\n");
        return ret;
 }