* [PATCH] drm/amd/pm: smu7: Remove stale error check in smu7_hwmgr_backend_init
@ 2026-04-10 12:40 Srinivasan Shanmugam
2026-04-10 14:14 ` Timur Kristóf
0 siblings, 1 reply; 2+ messages in thread
From: Srinivasan Shanmugam @ 2026-04-10 12:40 UTC (permalink / raw)
To: Christian König, Alex Deucher
Cc: amd-gfx, Srinivasan Shanmugam, Dan Carpenter, Timur Kristóf
smu7_hwmgr_backend_init() is responsible for initializing the SMU7 power
management backend. It allocates and sets up the backend structure,
initializes voltage tables, configures dependency tables, and prepares
platform-specific power and clock parameters.
The function follows a typical pattern where each initialization step
returns a status in "result", and failures are handled via a common
"goto fail" path that performs cleanup.
Commit 2c21648bb814 ("drm/amd/pm/smu7: Remove non-functional SMU7
voltage dependency on DAL") removed a function call in this
initialization sequence, but left behind the corresponding error check.
As a result, "result" is checked twice without being updated in between:
result = smu7_init_voltage_dependency_on_display_clock_table(hwmgr);
if (result)
goto fail;
...
if (result)
goto fail;
The second check is redundant and unreachable for any new failure, since
no operation modifies "result" between the two checks. This triggers a
Smatch warning about a duplicate zero check and reduces code clarity.
Remove the stale error check to keep the control flow correct and
readable.
Fixes: 2c21648bb814 ("drm/amd/pm/smu7: Remove non-functional SMU7 voltage dependency on DAL")
Reported-by: Dan Carpenter <error27@gmail.com>
Cc: Timur Kristóf <timur.kristof@gmail.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
---
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c
index 1381902547b8..4436ab2bb51f 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c
@@ -3062,9 +3062,6 @@ static int smu7_hwmgr_backend_init(struct pp_hwmgr *hwmgr)
smu7_set_private_data_based_on_pptable_v0(hwmgr);
}
- if (result)
- goto fail;
-
data->is_tlu_enabled = false;
hwmgr->platform_descriptor.hardwareActivityPerformanceLevels =
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/amd/pm: smu7: Remove stale error check in smu7_hwmgr_backend_init
2026-04-10 12:40 [PATCH] drm/amd/pm: smu7: Remove stale error check in smu7_hwmgr_backend_init Srinivasan Shanmugam
@ 2026-04-10 14:14 ` Timur Kristóf
0 siblings, 0 replies; 2+ messages in thread
From: Timur Kristóf @ 2026-04-10 14:14 UTC (permalink / raw)
To: Christian König, Alex Deucher, Srinivasan Shanmugam
Cc: amd-gfx, Srinivasan Shanmugam, Dan Carpenter
On Friday, April 10, 2026 2:40:06 PM Central European Summer Time Srinivasan
Shanmugam wrote:
> smu7_hwmgr_backend_init() is responsible for initializing the SMU7 power
> management backend. It allocates and sets up the backend structure,
> initializes voltage tables, configures dependency tables, and prepares
> platform-specific power and clock parameters.
>
> The function follows a typical pattern where each initialization step
> returns a status in "result", and failures are handled via a common
> "goto fail" path that performs cleanup.
>
> Commit 2c21648bb814 ("drm/amd/pm/smu7: Remove non-functional SMU7
> voltage dependency on DAL") removed a function call in this
> initialization sequence, but left behind the corresponding error check.
>
> As a result, "result" is checked twice without being updated in between:
>
> result = smu7_init_voltage_dependency_on_display_clock_table(hwmgr);
> if (result)
> goto fail;
>
> ...
>
> if (result)
> goto fail;
>
> The second check is redundant and unreachable for any new failure, since
> no operation modifies "result" between the two checks. This triggers a
> Smatch warning about a duplicate zero check and reduces code clarity.
>
> Remove the stale error check to keep the control flow correct and
> readable.
>
> Fixes: 2c21648bb814 ("drm/amd/pm/smu7: Remove non-functional SMU7 voltage
> dependency on DAL") Reported-by: Dan Carpenter <error27@gmail.com>
> Cc: Timur Kristóf <timur.kristof@gmail.com>
> Cc: Christian König <christian.koenig@amd.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
This makes good sense. Thank you for fixing this.
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
> ---
> drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c
> b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c index
> 1381902547b8..4436ab2bb51f 100644
> --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c
> +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c
> @@ -3062,9 +3062,6 @@ static int smu7_hwmgr_backend_init(struct pp_hwmgr
> *hwmgr) smu7_set_private_data_based_on_pptable_v0(hwmgr);
> }
>
> - if (result)
> - goto fail;
> -
> data->is_tlu_enabled = false;
>
> hwmgr->platform_descriptor.hardwareActivityPerformanceLevels =
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-04-10 14:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-10 12:40 [PATCH] drm/amd/pm: smu7: Remove stale error check in smu7_hwmgr_backend_init Srinivasan Shanmugam
2026-04-10 14:14 ` Timur Kristóf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox