AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Lazar, Lijo" <lijo.lazar@amd.com>
To: Mario Limonciello <mario.limonciello@amd.com>,
	amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH v3] drm/amd: Set num IP blocks to 0 if discovery fails
Date: Wed, 11 Mar 2026 09:54:47 +0530	[thread overview]
Message-ID: <0c6c1b03-50ca-43fd-a7cf-bcfd0975cdf3@amd.com> (raw)
In-Reply-To: <20260310165822.2930580-1-mario.limonciello@amd.com>



On 10-Mar-26 10:28 PM, Mario Limonciello wrote:
> If discovery has failed for any reason (such as no support for a block)
> then there is no need to unwind all the IP blocks in fini. In this
> condition there can actually be failures during the unwind too.
> 
> Reset num_ip_blocks to zero during failure path and skip the unnecessary
> cleanup path.
> 
> Suggested-by: Lijo Lazar <lijo.lazar@amd.com>
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>

Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>

Thanks,
Lijo

> ---
> v3:
>   * Skip cleanup path for early discovery failure
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 +++-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c    | 2 +-
>   2 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 5c24369821e47..c1949070a2969 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -2701,8 +2701,10 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)
>   		break;
>   	default:
>   		r = amdgpu_discovery_set_ip_blocks(adev);
> -		if (r)
> +		if (r) {
> +			adev->num_ip_blocks = 0;
>   			return r;
> +		}
>   		break;
>   	}
>   
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> index 77e2133de5cf9..7f19554b9ad11 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> @@ -83,7 +83,7 @@ void amdgpu_driver_unload_kms(struct drm_device *dev)
>   {
>   	struct amdgpu_device *adev = drm_to_adev(dev);
>   
> -	if (adev == NULL)
> +	if (adev == NULL || !adev->num_ip_blocks)
>   		return;
>   
>   	amdgpu_unregister_gpu_instance(adev);


      reply	other threads:[~2026-03-11  4:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-10 16:58 [PATCH v3] drm/amd: Set num IP blocks to 0 if discovery fails Mario Limonciello
2026-03-11  4:24 ` Lazar, Lijo [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=0c6c1b03-50ca-43fd-a7cf-bcfd0975cdf3@amd.com \
    --to=lijo.lazar@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=mario.limonciello@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