From: Huang Rui Date: Mon, 9 May 2016 09:29:41 +0000 (+0800) Subject: drm/amd/powerplay: rewrite pp_sw_init to make code readable X-Git-Tag: MMI-PSA29.97-13-9~7809^2~1^2~27 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b4eeed590deeff13a53db641129f0301d70248f3;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git drm/amd/powerplay: rewrite pp_sw_init to make code readable 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 Signed-off-by: Huang Rui Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c index 9f2d4069a5f3..8e345bfddb69 100644 --- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c +++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c @@ -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; }