[PATCH] usb: gadget: fix bugon.cocci warnings

From: kbuild test robot
Date: Fri Oct 16 2015 - 12:39:04 EST


drivers/usb/gadget/udc/cadence_hsudc.c:1303:2-5: WARNING: Use BUG_ON instead of if condition followed by BUG.
Please make sure the condition has no side effects (see conditional BUG_ON definition in include/asm-generic/bug.h)

Use BUG_ON instead of a if condition followed by BUG.

Semantic patch information:
This makes an effort to find cases where BUG() follows an if
condition on an expression and replaces the if condition and BUG()
with a BUG_ON having the conditional expression of the if statement
as argument.

Generated by: scripts/coccinelle/misc/bugon.cocci

CC: Neil Armstrong <narmstrong@xxxxxxxxxxxx>
Signed-off-by: Fengguang Wu <fengguang.wu@xxxxxxxxx>
---

Please take the patch only if it's a positive warning. Thanks!

cadence_hsudc.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

--- a/drivers/usb/gadget/udc/cadence_hsudc.c
+++ b/drivers/usb/gadget/udc/cadence_hsudc.c
@@ -1299,8 +1299,7 @@ static void hsudc_ep_work(struct work_st

hsudc_ep->cur = hsudc_req;

- if (!hsudc_req)
- BUG();
+ BUG_ON(!hsudc_req);

spin_unlock(&hsudc_ep->s);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/