Blob Blame History Raw
From afe65e430d1fdcffa3843c499b96e332d619cd2c Mon Sep 17 00:00:00 2001
From: Kishore KP <kishore.p@techveda.org>
Date: Sun, 24 Dec 2017 19:33:54 +0530
Subject: [PATCH] staging: vc04_services: Prefer WARN_ON_ONCE instead of if condition followed by BUG.
Git-commit: afe65e430d1fdcffa3843c499b96e332d619cd2c
Patch-mainline: v4.16-rc1
References: FATE#324827

Coccinelle suggested to use BUG_ON instead of if condition followed by BUG
but BUG_ON should be used in situations where integrity of the system is no
longer guaranteed. In this case, as suggested by Stefan Wahren, vchiq isn't
critical.
Since it is not critical, BUG_ON should be avoided.
Replaced if condition followed by BUG with WARN_ON_ONCE.

Signed-off-by: Kishore KP <kishore.p@techveda.org>
Signed-off-by: Suniel Mahesh <sunil.m@techveda.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Takashi Iwai <tiwai@suse.de>

---
 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
@@ -224,8 +224,7 @@ vchiq_platform_get_arm_state(VCHIQ_STATE
 
 	platform_state   = (struct vchiq_2835_state *)state->platform_state;
 
-	if (!platform_state->inited)
-		BUG();
+	WARN_ON_ONCE(!platform_state->inited);
 
 	return &platform_state->arm_state;
 }