ChangeSet 1.1325.4.4, 2003/09/23 17:04:08-07:00, henning@meier-geinitz.de [PATCH] USB scanner driver: balancing usb_register_dev/usb_deregister_dev Balancing usb_register_dev/usb_deregister_dev in probe_scanner when a fail condition occours (Daniele Bellucci). drivers/usb/image/scanner.c | 6 ++++++ 1 files changed, 6 insertions(+) diff -Nru a/drivers/usb/image/scanner.c b/drivers/usb/image/scanner.c --- a/drivers/usb/image/scanner.c Thu Sep 25 14:32:27 2003 +++ b/drivers/usb/image/scanner.c Thu Sep 25 14:32:27 2003 @@ -374,6 +374,8 @@ * (Daniele Bellucci). * - Report back return codes of usb_register and usb_usbmit_urb instead of -1 or * -ENONMEM (Daniele Bellucci). + * - Balancing usb_register_dev/usb_deregister_dev in probe_scanner when a fail + * condition occours (Daniele Bellucci). * * * TODO @@ -1050,6 +1052,7 @@ scn->scn_irq = usb_alloc_urb(0, GFP_KERNEL); if (!scn->scn_irq) { + usb_deregister_dev(intf, &scanner_class); kfree(scn); up(&scn_mutex); return -ENOMEM; @@ -1071,6 +1074,7 @@ retval = usb_submit_urb(scn->scn_irq, GFP_KERNEL); if (retval) { err("probe_scanner(%d): Unable to allocate INT URB.", intf->minor); + usb_deregister_dev(intf, &scanner_class); kfree(scn); up(&scn_mutex); return retval; @@ -1084,6 +1088,7 @@ if (have_intr) usb_unlink_urb(scn->scn_irq); usb_free_urb(scn->scn_irq); + usb_deregister_dev(intf, &scanner_class); kfree(scn); up(&scn_mutex); return -ENOMEM; @@ -1095,6 +1100,7 @@ if (have_intr) usb_unlink_urb(scn->scn_irq); usb_free_urb(scn->scn_irq); + usb_deregister_dev(intf, &scanner_class); kfree(scn->obuf); kfree(scn); up(&scn_mutex);