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

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

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
index 544d6aafb11a5..fc27d099bafc2 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
@@ -4580,7 +4580,7 @@ static const struct amdgpu_gfx_funcs gfx_v10_0_gfx_funcs 
= {
 
 static void gfx_v10_0_gpu_early_init(struct amdgpu_device *adev)
 {
-       u32 gb_addr_config;
+       u32 gb_addr_config = 0;
 
        switch (amdgpu_ip_version(adev, GC_HWIP, 0)) {
        case IP_VERSION(10, 1, 10):
@@ -4620,7 +4620,6 @@ static void gfx_v10_0_gpu_early_init(struct amdgpu_device 
*adev)
                gb_addr_config = CYAN_SKILLFISH_GB_ADDR_CONFIG_GOLDEN;
                break;
        default:
-               BUG();
                break;
        }
 
@@ -8594,13 +8593,16 @@ static u64 gfx_v10_0_ring_get_rptr_compute(struct 
amdgpu_ring *ring)
 
 static u64 gfx_v10_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_v10_0_ring_get_wptr_compute() requires 
doorbell!\n");
+               wptr = 0;
+       }
        return wptr;
 }
 
@@ -8613,7 +8615,7 @@ static void gfx_v10_0_ring_set_wptr_compute(struct 
amdgpu_ring *ring)
                             ring->wptr);
                WDOORBELL64(ring->doorbell_index, ring->wptr);
        } else {
-               BUG(); /* only DOORBELL method supported on gfx10 now */
+               dev_warn(adev->dev, "gfx_v10_0_ring_set_wptr_compute() requires 
doorbell!\n");
        }
 }
 
@@ -9371,7 +9373,7 @@ static void gfx_v10_0_handle_priv_fault(struct 
amdgpu_device *adev,
                }
                break;
        default:
-               BUG();
+               break;
        }
 }
 
@@ -9441,7 +9443,7 @@ static int gfx_v10_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.54.0

Reply via email to