[PATCH] drm/amd/powerplay: rewrite pp_sw_init to make code readable
Alex Deucher
alexdeucher at gmail.com
Tue May 10 22:22:32 UTC 2016
From: Huang Rui <ray.huang at amd.com>
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 at amd.com>
Signed-off-by: Huang Rui <ray.huang at amd.com>
Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
---
drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
index 9f2d4069..8e345bf 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;
}
--
2.5.5
More information about the dri-devel
mailing list