ChangeSet 1.1003.36.5, 2003/07/17 15:51:31-07:00, henning@meier-geinitz.de [PATCH] USB: unlink interrupt URBs in scanner driver Clean up irq urb when not enough memory is available (Sergey Vlasov). drivers/usb/scanner.c | 5 +++++ 1 files changed, 5 insertions(+) diff -Nru a/drivers/usb/scanner.c b/drivers/usb/scanner.c --- a/drivers/usb/scanner.c Thu Aug 28 14:50:36 2003 +++ b/drivers/usb/scanner.c Thu Aug 28 14:50:36 2003 @@ -376,6 +376,7 @@ * check for scn->present. This avoids crashing when someone writes (reads) to * the device while it's already disconnected but still open. Patch from * Sergey Vlasov. + * - Clean up irq urb when not enough memory is available (Sergey Vlasov). * * TODO * - Performance @@ -1040,6 +1041,8 @@ /* Ok, now initialize all the relevant values */ if (!(scn->obuf = (char *)kmalloc(OBUF_SIZE, GFP_KERNEL))) { err("probe_scanner(%d): Not enough memory for the output buffer.", scn_minor); + if (have_intr) + usb_unlink_urb(&scn->scn_irq); kfree(scn); up(&scn_mutex); return NULL; @@ -1048,6 +1051,8 @@ if (!(scn->ibuf = (char *)kmalloc(IBUF_SIZE, GFP_KERNEL))) { err("probe_scanner(%d): Not enough memory for the input buffer.", scn_minor); + if (have_intr) + usb_unlink_urb(&scn->scn_irq); kfree(scn->obuf); kfree(scn); up(&scn_mutex);