All of lore.kernel.org
 help / color / mirror / Atom feed
From: kishore.p@techveda.org
To: eric@anholt.net, stefan.wahren@i2se.com, gregkh@linuxfoundation.org
Cc: linux-arm-kernel@lists.infradead.org,
	linux-rpi-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org,
	karthik@techveda.org, shrikant.maurya@techveda.org,
	Kishore KP <kishore.p@techveda.org>,
	Suniel Mahesh <sunil.m@techveda.org>
Subject: [PATCH v2] staging: vc04_services: Prefer WARN_ON_ONCE instead of if condition followed by BUG.
Date: Sun, 24 Dec 2017 19:33:54 +0530	[thread overview]
Message-ID: <1514124234-11205-1-git-send-email-kishore.p@techveda.org> (raw)
In-Reply-To: <397155882.297531.1514045090990@email.1und1.de>

From: Kishore KP <kishore.p@techveda.org>

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>
---
Changes for v2:
- Subject and Description modified a bit based on the suggestion
  by Stefan Wahren.
---
Note:
- Patch was compile tested and built(ARCH=arm) on linux-next
  (latest).
- No build issues reported.
---
 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
index 315b49c..f20cf88 100644
--- 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 @@ int vchiq_platform_init(struct platform_device *pdev, VCHIQ_STATE_T *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;
 }
-- 
1.9.1

WARNING: multiple messages have this Message-ID (diff)
From: kishore.p@techveda.org (kishore.p at techveda.org)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] staging: vc04_services: Prefer WARN_ON_ONCE instead of if condition followed by BUG.
Date: Sun, 24 Dec 2017 19:33:54 +0530	[thread overview]
Message-ID: <1514124234-11205-1-git-send-email-kishore.p@techveda.org> (raw)
In-Reply-To: <397155882.297531.1514045090990@email.1und1.de>

From: Kishore KP <kishore.p@techveda.org>

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>
---
Changes for v2:
- Subject and Description modified a bit based on the suggestion
  by Stefan Wahren.
---
Note:
- Patch was compile tested and built(ARCH=arm) on linux-next
  (latest).
- No build issues reported.
---
 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
index 315b49c..f20cf88 100644
--- 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 @@ int vchiq_platform_init(struct platform_device *pdev, VCHIQ_STATE_T *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;
 }
-- 
1.9.1

  reply	other threads:[~2017-12-24 14:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-23 15:06 [PATCH] staging: vc04_services: Prefer BUG_ON instead of if condition followed by BUG kishore.p
2017-12-23 15:06 ` kishore.p at techveda.org
2017-12-23 16:04 ` Stefan Wahren
2017-12-23 16:04   ` Stefan Wahren
2017-12-24 14:03   ` kishore.p [this message]
2017-12-24 14:03     ` [PATCH v2] staging: vc04_services: Prefer WARN_ON_ONCE " kishore.p at techveda.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1514124234-11205-1-git-send-email-kishore.p@techveda.org \
    --to=kishore.p@techveda.org \
    --cc=devel@driverdev.osuosl.org \
    --cc=eric@anholt.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=karthik@techveda.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=shrikant.maurya@techveda.org \
    --cc=stefan.wahren@i2se.com \
    --cc=sunil.m@techveda.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.