There's no need to crash the kernel for these cases.

Signed-off-by: Alex Deucher <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
index d5cb653639a64..a286aee31f72f 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
@@ -1145,8 +1145,7 @@ static int gfx_v11_0_gpu_early_init(struct amdgpu_device 
*adev)
                adev->gfx.config.sc_earlyz_tile_fifo_size = 0x300;
                break;
        default:
-               BUG();
-               break;
+               return -EINVAL;
        }
 
        return 0;
@@ -5958,13 +5957,16 @@ static u64 gfx_v11_0_ring_get_rptr_compute(struct 
amdgpu_ring *ring)
 
 static u64 gfx_v11_0_ring_get_wptr_compute(struct amdgpu_ring *ring)
 {
+       struct amdgpu_device *adev = ring->adev;
        u64 wptr;
 
        /* XXX check if swapping is necessary on BE */
-       if (ring->use_doorbell)
+       if (ring->use_doorbell) {
                wptr = atomic64_read((atomic64_t *)ring->wptr_cpu_addr);
-       else
-               BUG();
+       } else {
+               dev_warn(adev->dev, "gfx_v11_0_ring_get_wptr_compute() requires 
doorbell!\n");
+               wptr = 0;
+       }
        return wptr;
 }
 
@@ -5978,7 +5980,7 @@ static void gfx_v11_0_ring_set_wptr_compute(struct 
amdgpu_ring *ring)
                             ring->wptr);
                WDOORBELL64(ring->doorbell_index, ring->wptr);
        } else {
-               BUG(); /* only DOORBELL method supported on gfx11 now */
+               dev_warn(adev->dev, "gfx_v11_0_ring_set_wptr_compute() requires 
doorbell!\n");
        }
 }
 
@@ -6751,7 +6753,6 @@ static void gfx_v11_0_handle_priv_fault(struct 
amdgpu_device *adev,
                        }
                        break;
                default:
-                       BUG();
                        break;
                }
        }
@@ -6836,7 +6837,7 @@ static int gfx_v11_0_kiq_set_interrupt_state(struct 
amdgpu_device *adev,
                }
                break;
        default:
-               BUG(); /* kiq only support GENERIC2_INT now */
+               /* kiq only support GENERIC2_INT now */
                break;
        }
        return 0;
-- 
2.55.0

Reply via email to