ChangeSet 1.1325.4.3, 2003/09/23 16:59:34-07:00, henning@meier-geinitz.de [PATCH] USB scanner driver: report back return codes Report back return codes of usb_register and usb_usbmit_urb instead of -1 or -ENONMEM (Daniele Bellucci). drivers/usb/image/scanner.c | 16 +++++++++++----- 1 files changed, 11 insertions(+), 5 deletions(-) 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:33 2003 +++ b/drivers/usb/image/scanner.c Thu Sep 25 14:32:33 2003 @@ -372,6 +372,8 @@ * 0.4.15 2003-09-12 * - Use static declarations for usb_scanner_init/usb_scanner_exit * (Daniele Bellucci). + * - Report back return codes of usb_register and usb_usbmit_urb instead of -1 or + * -ENONMEM (Daniele Bellucci). * * * TODO @@ -1066,11 +1068,12 @@ // endpoint[(int)have_intr].bInterval); 250); - if (usb_submit_urb(scn->scn_irq, GFP_KERNEL)) { + retval = usb_submit_urb(scn->scn_irq, GFP_KERNEL); + if (retval) { err("probe_scanner(%d): Unable to allocate INT URB.", intf->minor); kfree(scn); up(&scn_mutex); - return -ENOMEM; + return retval; } } @@ -1183,13 +1186,16 @@ static int __init usb_scanner_init (void) { - if (usb_register(&scanner_driver) < 0) - return -1; + int retval; + retval = usb_register(&scanner_driver); + if (retval) + goto out; info(DRIVER_VERSION ":" DRIVER_DESC); if (vendor != -1 && product != -1) info("probe_scanner: User specified USB scanner -- Vendor:Product - %x:%x", vendor, product); - return 0; + out: + return retval; } module_init(usb_scanner_init);