All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: vc04_services: Prefer BUG_ON instead of if condition followed by BUG.
@ 2017-12-23 15:06 ` kishore.p at techveda.org
  0 siblings, 0 replies; 6+ messages in thread
From: kishore.p @ 2017-12-23 15:06 UTC (permalink / raw)
  To: eric, stefan.wahren, gregkh
  Cc: linux-arm-kernel, linux-rpi-kernel, linux-kernel, devel, karthik,
	shrikant.maurya, Kishore KP, Suniel Mahesh

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

Use BUG_ON instead of if condition followed by BUG.
Pointed out by Coccinelle.

Signed-off-by: Kishore KP <kishore.p@techveda.org>
Signed-off-by: Suniel Mahesh <sunil.m@techveda.org>
---
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..7116f61 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();
+	BUG_ON(!platform_state->inited);
 
 	return &platform_state->arm_state;
 }
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] staging: vc04_services: Prefer BUG_ON instead of if condition followed by BUG.
@ 2017-12-23 15:06 ` kishore.p at techveda.org
  0 siblings, 0 replies; 6+ messages in thread
From: kishore.p at techveda.org @ 2017-12-23 15:06 UTC (permalink / raw)
  To: linux-arm-kernel

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

Use BUG_ON instead of if condition followed by BUG.
Pointed out by Coccinelle.

Signed-off-by: Kishore KP <kishore.p@techveda.org>
Signed-off-by: Suniel Mahesh <sunil.m@techveda.org>
---
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..7116f61 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();
+	BUG_ON(!platform_state->inited);
 
 	return &platform_state->arm_state;
 }
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] staging: vc04_services: Prefer BUG_ON instead of if condition followed by BUG.
  2017-12-23 15:06 ` kishore.p at techveda.org
@ 2017-12-23 16:04   ` Stefan Wahren
  -1 siblings, 0 replies; 6+ messages in thread
From: Stefan Wahren @ 2017-12-23 16:04 UTC (permalink / raw)
  To: kishore.p, eric, gregkh
  Cc: Suniel Mahesh, karthik, linux-kernel, devel, shrikant.maurya,
	linux-rpi-kernel, linux-arm-kernel

Hi Kishore,

> kishore.p@techveda.org hat am 23. Dezember 2017 um 16:06 geschrieben:
> 
> 
> From: Kishore KP <kishore.p@techveda.org>
> 
> Use BUG_ON instead of if condition followed by BUG.
> Pointed out by Coccinelle.
> 
> Signed-off-by: Kishore KP <kishore.p@techveda.org>
> Signed-off-by: Suniel Mahesh <sunil.m@techveda.org>
> ---
> 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..7116f61 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();
> +	BUG_ON(!platform_state->inited);
>  

vchiq isn't critical so i prefer WARN_ON_ONCE() here.

Thanks
Stefan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] staging: vc04_services: Prefer BUG_ON instead of if condition followed by BUG.
@ 2017-12-23 16:04   ` Stefan Wahren
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Wahren @ 2017-12-23 16:04 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Kishore,

> kishore.p at techveda.org hat am 23. Dezember 2017 um 16:06 geschrieben:
> 
> 
> From: Kishore KP <kishore.p@techveda.org>
> 
> Use BUG_ON instead of if condition followed by BUG.
> Pointed out by Coccinelle.
> 
> Signed-off-by: Kishore KP <kishore.p@techveda.org>
> Signed-off-by: Suniel Mahesh <sunil.m@techveda.org>
> ---
> 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..7116f61 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();
> +	BUG_ON(!platform_state->inited);
>  

vchiq isn't critical so i prefer WARN_ON_ONCE() here.

Thanks
Stefan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2] staging: vc04_services: Prefer WARN_ON_ONCE instead of if condition followed by BUG.
  2017-12-23 16:04   ` Stefan Wahren
@ 2017-12-24 14:03     ` kishore.p at techveda.org
  -1 siblings, 0 replies; 6+ messages in thread
From: kishore.p @ 2017-12-24 14:03 UTC (permalink / raw)
  To: eric, stefan.wahren, gregkh
  Cc: linux-arm-kernel, linux-rpi-kernel, linux-kernel, devel, karthik,
	shrikant.maurya, Kishore KP, Suniel Mahesh

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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2] staging: vc04_services: Prefer WARN_ON_ONCE instead of if condition followed by BUG.
@ 2017-12-24 14:03     ` kishore.p at techveda.org
  0 siblings, 0 replies; 6+ messages in thread
From: kishore.p at techveda.org @ 2017-12-24 14:03 UTC (permalink / raw)
  To: linux-arm-kernel

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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-12-24 14:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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   ` [PATCH v2] staging: vc04_services: Prefer WARN_ON_ONCE " kishore.p
2017-12-24 14:03     ` kishore.p at techveda.org

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.