[PATCH 2/2] usb: f_fs: replace BUG in dead-code with less serious WARN_ON

From: Michal Nazarewicz
Date: Wed Sep 10 2014 - 11:50:53 EST


Even though the BUG() in __ffs_event_add is a dead-code, it is still
better to warn rather then crash the system if that code ever gets
executed.

Suggested-by: Felipe Balbi <balbi@xxxxxx>
Signed-off-by: Michal Nazarewicz <mina86@xxxxxxxxxx>
---
This has been compile tested only.

drivers/usb/gadget/function/f_fs.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
index ec50e0d..74d48b3 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -2321,7 +2321,9 @@ static void __ffs_event_add(struct ffs_data *ffs,
break;

default:
- BUG();
+ pr_vdebug("%d: unknown event, this should not happen\n", type);
+ WARN_ON(1);
+ return;
}

{
--
2.1.0.rc2.206.gedb03e5

--
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/