]> git.hungrycats.org Git - linux/commitdiff
drm/amdgpu: Fix IP block NULL check during soft reset
authorTimur Kristóf <timur.kristof@gmail.com>
Fri, 10 Jul 2026 07:36:48 +0000 (09:36 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 15 Jul 2026 13:15:42 +0000 (09:15 -0400)
We can't print the IP block name when the IP block is NULL.

Note that it should never be NULL, the only way that
can happen is when amdgpu_ip_from_ring() is missing the
given ring type. The check is just there to be sure.

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <error27@gmail.com>
Closes: https://lore.kernel.org/r/202607031711.yLwFhGfp-lkp@intel.com/
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_ip.c

index 33a04113ed74f6950f1cceb1f9148bbf1d76b1ae..922f4b15619d551e97005c1574f8472441bc3904 100644 (file)
@@ -489,7 +489,13 @@ int amdgpu_device_ip_soft_reset(struct amdgpu_ring *guilty_ring,
        ip_type = amdgpu_ip_from_ring(guilty_ring->funcs->type);
        ip_block = amdgpu_device_ip_get_ip_block(adev, ip_type);
 
-       if (!ip_block || !ip_block->version->funcs->soft_reset) {
+       if (unlikely(!ip_block)) {
+               dev_warn(adev->dev, "IP block not found for ring %s\n",
+                        guilty_ring->name);
+               return -EOPNOTSUPP;
+       }
+
+       if (!ip_block->version->funcs->soft_reset) {
                dev_warn(adev->dev, "IP block soft reset not supported on %s\n",
                         ip_block->version->funcs->name);
                return -EOPNOTSUPP;