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 <[email protected]>
Signed-off-by: Mario Limonciello <[email protected]>
---
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

Reply via email to