Skip to contentSkip to conversation

drm/msm: use BUG_ON macro for debugging.

PATCH In review Wambui Karuga 2 participants 2 messages Dec 30, 2019 – Dec 31, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/msm: use BUG_ON macro for debugging.

As the if statement only checks for the value of the offset_name variable, it can be replaced by the more conscise BUG_ON macro for error reporting.

---
 drivers/gpu/drm/msm/adreno/adreno_gpu.h | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/msm/adreno/adreno_gpu.h +1 -4
index c7441fb8313e..0fe7907f5a7d 100644
@@ -315,10 +315,7 @@ OUT_PKT7(struct msm_ringbuffer *ring, uint8_t opcode, uint16_t cnt)
 static inline bool adreno_reg_check(struct adreno_gpu *gpu,
 		enum adreno_regs offset_name)
 {
-	if (offset_name >= REG_ADRENO_REGISTER_MAX ||
-			!gpu->reg_offsets[offset_name]) {
-		BUG();
-	}
+	BUG_ON(offset_name >= REG_ADRENO_REGISTER_MAX || !gpu->reg_offsets[offset_name]);
 
 	/*
 	 * REG_SKIP is a special value that tell us that the register in
Signature · 1 line
2.17.1
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · Wambui Karuga

As the if statement only checks for the value of the offset_name variable, it can be replaced by the more conscise BUG_ON macro for error reporting.

---
 drivers/gpu/drm/msm/adreno/adreno_gpu.h | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/msm/adreno/adreno_gpu.h +0 -0
index c7441fb8313e..0fe7907f5a7d 100644

drivers/gpu/drm/msm/adreno/adreno_gpu.h OUT_PKT7(struct msm_ringbuffer *ring, uint8_t opcode, uint16_t cnt) · line 319

Quoted 9 lines
drivers/gpu/drm/msm/adreno/adreno_gpu.h +1 -4
@@ -315,10 +315,7 @@ OUT_PKT7(struct msm_ringbuffer *ring, uint8_t opcode, uint16_t cnt)
 static inline bool adreno_reg_check(struct adreno_gpu *gpu,
                enum adreno_regs offset_name)
 {
-       if (offset_name >= REG_ADRENO_REGISTER_MAX ||
-                       !gpu->reg_offsets[offset_name]) {
-               BUG();
-       }
+       BUG_ON(offset_name >= REG_ADRENO_REGISTER_MAX || !gpu->reg_offsets[offset_name]);
 

Minor nit: This line is longer than 80 chars

Other than that,

Quoted 5 lines
drivers/gpu/drm/msm/adreno/adreno_gpu.h +0 -1
        /*
         * REG_SKIP is a special value that tell us that the register in
--

2.17.1