[PATCH v4] staging: nvec: Avoid the use of BUG_ON

Laura Garcia Liebana nevola at gmail.com
Wed Feb 24 17:11:07 UTC 2016


Prevent a kernel panic by avoiding the use of the BUG_ON macro.
Checkpatch detected this issue.

The BUG_ON macro is not needed as such cases shouldn't happen and they
were introduced for debugging purposes.

Signed-off-by: Laura Garcia Liebana <nevola at gmail.com>
---
Changes in v2:
	- Remove the BUG_ON macro used in the module, as Marc Dietrich suggested.

Changes in v3:
	- Include detailed commit message according to the reason of the macro removal, as Fabio Estevam suggested.

Changes in v4:
	- Commit message adjustment in order to avoid the WARN_ON macro which is not used, as Julia suggested.

 drivers/staging/nvec/nvec.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
index c335ae2..f6a1dbb 100644
--- a/drivers/staging/nvec/nvec.c
+++ b/drivers/staging/nvec/nvec.c
@@ -641,11 +641,9 @@ static irqreturn_t nvec_interrupt(int irq, void *dev)
 			nvec_msg_free(nvec, nvec->rx);
 			nvec->state = 3;
 			nvec_tx_set(nvec);
-			BUG_ON(nvec->tx->size < 1);
 			to_send = nvec->tx->data[0];
 			nvec->tx->pos = 1;
 		} else if (status == (I2C_SL_IRQ)) {
-			BUG_ON(nvec->rx == NULL);
 			nvec->rx->data[1] = received;
 			nvec->rx->pos = 2;
 			nvec->state = 4;
-- 
2.7.0



More information about the devel mailing list