public inbox for amd-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Timur Kristóf" <timur.kristof@gmail.com>
To: "Christian König" <christian.koenig@amd.com>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Srinivasan Shanmugam" <srinivasan.shanmugam@amd.com>
Cc: amd-gfx@lists.freedesktop.org,
	Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>,
	Dan Carpenter <error27@gmail.com>
Subject: Re: [PATCH] drm/amd/pm: smu7: Remove stale error check in smu7_hwmgr_backend_init
Date: Fri, 10 Apr 2026 16:14:20 +0200	[thread overview]
Message-ID: <2213119.9o76ZdvQCi@timur-hyperion> (raw)
In-Reply-To: <20260410124006.2293461-1-srinivasan.shanmugam@amd.com>

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 =





      reply	other threads:[~2026-04-10 14:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2213119.9o76ZdvQCi@timur-hyperion \
    --to=timur.kristof@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=error27@gmail.com \
    --cc=srinivasan.shanmugam@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox