[PATCH] rxrpc: key: use BUG_ON instead of if condition followed by BUG

From: Gustavo A. R. Silva
Date: Tue Oct 24 2017 - 12:24:34 EST


Use BUG_ON instead of if condition followed by BUG.

This issue was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <garsilva@xxxxxxxxxxxxxx>
---
net/rxrpc/key.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/rxrpc/key.c b/net/rxrpc/key.c
index e7f6b88..b7cc1b1 100644
--- a/net/rxrpc/key.c
+++ b/net/rxrpc/key.c
@@ -851,8 +851,7 @@ static int rxrpc_preparse_s(struct key_preparsed_payload *prep)
return PTR_ERR(ci);
}

- if (crypto_skcipher_setkey(ci, prep->data, 8) < 0)
- BUG();
+ BUG_ON(crypto_skcipher_setkey(ci, prep->data, 8) < 0);

prep->payload.data[0] = ci;
_leave(" = 0");
--
2.7.4