media: ir_toy: do not resubmit broken urb
authorSean Young <sean@mess.org>
Wed, 8 Sep 2021 09:22:40 +0000 (11:22 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Thu, 30 Sep 2021 08:08:01 +0000 (10:08 +0200)
This causes the same urb to resubmitted continuously, hogging up a cpu.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/rc/ir_toy.c

index 2b7c8bb..d2d9346 100644 (file)
@@ -213,10 +213,20 @@ static void irtoy_in_callback(struct urb *urb)
        struct irtoy *irtoy = urb->context;
        int ret;
 
-       if (urb->status == 0)
+       switch (urb->status) {
+       case 0:
                irtoy_response(irtoy, urb->actual_length);
-       else
+               break;
+       case -ECONNRESET:
+       case -ENOENT:
+       case -ESHUTDOWN:
+       case -EPROTO:
+       case -EPIPE:
+               usb_unlink_urb(urb);
+               return;
+       default:
                dev_dbg(irtoy->dev, "in urb status: %d\n", urb->status);
+       }
 
        ret = usb_submit_urb(urb, GFP_ATOMIC);
        if (ret && ret != -ENODEV)