diff mbox series

drm/amd/pm: Fix error code in vega10_hwmgr_backend_init()

Message ID 502fda28-fde7-4851-b17f-4d48848955bc@moroto.mountain (mailing list archive)
State New, archived
Headers show
Series drm/amd/pm: Fix error code in vega10_hwmgr_backend_init() | expand

Commit Message

Dan Carpenter May 4, 2024, 11:26 a.m. UTC
Return -EINVAL on error instead of success.  Also on the success path,
return a literal zero instead of "return result;"

Fixes: e098bc9612c2 ("drm/amd/pm: optimize the power related source code layout")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Markus Elfring May 4, 2024, 5:13 p.m. UTC | #1
> Return -EINVAL on error instead of success.  Also on the success path,
> return a literal zero instead of "return result;"

How do you think about to omit the initialisation for the variable “result”
in another update step?

Regards,
Markus
diff mbox series

Patch

diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c
index 37c915d7723c..9b9f8615070a 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c
@@ -924,7 +924,7 @@  static int vega10_hwmgr_backend_init(struct pp_hwmgr *hwmgr)
 
 	data->total_active_cus = adev->gfx.cu_info.number;
 	if (!hwmgr->not_vf)
-		return result;
+		return -EINVAL;
 
 	/* Setup default Overdrive Fan control settings */
 	data->odn_fan_table.target_fan_speed =
@@ -947,7 +947,7 @@  static int vega10_hwmgr_backend_init(struct pp_hwmgr *hwmgr)
 			"Mem Channel Index Exceeded maximum!",
 			return -EINVAL);
 
-	return result;
+	return 0;
 }
 
 static int vega10_init_sclk_threshold(struct pp_hwmgr *hwmgr)