[media] pctv452e: don't call BUG_ON() on non-fatal error
authorMauro Carvalho Chehab <mchehab@s-opensource.com>
Fri, 7 Oct 2016 17:15:53 +0000 (14:15 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Fri, 14 Oct 2016 15:47:13 +0000 (12:47 -0300)
There are some conditions on this driver that are tested with
BUG_ON() with are not serious enough to hang a machine.

So, just return an error if this happens.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/usb/dvb-usb/pctv452e.c

index 58b685094904f556ebbac51102f01c2b82acb739..7ad0006c5ae08c51c94c1ea4a5b9f8391d71131e 100644 (file)
@@ -109,9 +109,10 @@ static int tt3650_ci_msg(struct dvb_usb_device *d, u8 cmd, u8 *data,
        unsigned int rlen;
        int ret;
 
-       BUG_ON(NULL == data && 0 != (write_len | read_len));
-       BUG_ON(write_len > 64 - 4);
-       BUG_ON(read_len > 64 - 4);
+       if (!data || (write_len > 64 - 4) || (read_len > 64 - 4)) {
+               err("%s: transfer data invalid", __func__);
+               return -EIO;
+       };
 
        mutex_lock(&state->ca_mutex);
        id = state->c++;