All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] drm/amd: Set num IP blocks to 0 if discovery fails
@ 2026-03-10  2:22 Mario Limonciello
  2026-03-10  5:12 ` Lazar, Lijo
  0 siblings, 1 reply; 2+ messages in thread
From: Mario Limonciello @ 2026-03-10  2:22 UTC (permalink / raw)
  To: amd-gfx; +Cc: Mario Limonciello, Lijo Lazar

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.

Suggested-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
v2:
 * Stop chasing NULL pointers (Lijo)
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index bc6f714e8763a..042f24a0e10fb 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;
 	}
 
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] drm/amd: Set num IP blocks to 0 if discovery fails
  2026-03-10  2:22 [PATCH v2] drm/amd: Set num IP blocks to 0 if discovery fails Mario Limonciello
@ 2026-03-10  5:12 ` Lazar, Lijo
  0 siblings, 0 replies; 2+ messages in thread
From: Lazar, Lijo @ 2026-03-10  5:12 UTC (permalink / raw)
  To: Mario Limonciello, amd-gfx



On 10-Mar-26 7:52 AM, 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.
> 
> Suggested-by: Lijo Lazar <lijo.lazar@amd.com>
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>

This will do specifically for the ip block checks.

Wondering whether amdgpu_driver_unload_kms() also should be modified. 
For ex: calling amdgpu_unregister_gpu_instance and 
amdgpu_device_fini_hw() don't seem to be relevant if discovery fails.

Thanks,
Lijo

> ---
> v2:
>   * Stop chasing NULL pointers (Lijo)
>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index bc6f714e8763a..042f24a0e10fb 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;
>   	}
>   


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-03-10  5:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-10  2:22 [PATCH v2] drm/amd: Set num IP blocks to 0 if discovery fails Mario Limonciello
2026-03-10  5:12 ` Lazar, Lijo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.