2024-05-04 11:26:27

by Dan Carpenter

[permalink] [raw]
Subject: [PATCH] drm/amd/pm: Fix error code in vega10_hwmgr_backend_init()

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 <[email protected]>
---
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

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)
--
2.43.0



2024-05-04 17:14:25

by Markus Elfring

[permalink] [raw]
Subject: Re: [PATCH] drm/amd/pm: Fix error code in vega10_hwmgr_backend_init()

> 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