Commit 9e1f15f6 authored by Daniele Bellucci's avatar Daniele Bellucci Committed by Greg Kroah-Hartman

[PATCH] Audit and minor cleanups in drivers/usb/*

- if usb_register fails report back its return code rather than -1
- static declarations for module_init/cleanup functions
parent dca06da9
...@@ -977,8 +977,9 @@ static struct usb_driver mdc800_usb_driver = ...@@ -977,8 +977,9 @@ static struct usb_driver mdc800_usb_driver =
#define try_free_mem(A) if (A != 0) { kfree (A); A=0; } #define try_free_mem(A) if (A != 0) { kfree (A); A=0; }
#define try_free_urb(A) if (A != 0) { usb_free_urb (A); A=0; } #define try_free_urb(A) if (A != 0) { usb_free_urb (A); A=0; }
int __init usb_mdc800_init (void) static int __init usb_mdc800_init (void)
{ {
int retval;
/* Allocate Memory */ /* Allocate Memory */
try (mdc800=kmalloc (sizeof (struct mdc800_data), GFP_KERNEL)); try (mdc800=kmalloc (sizeof (struct mdc800_data), GFP_KERNEL));
...@@ -1005,7 +1006,8 @@ int __init usb_mdc800_init (void) ...@@ -1005,7 +1006,8 @@ int __init usb_mdc800_init (void)
try (mdc800->write_urb=usb_alloc_urb (0, GFP_KERNEL)); try (mdc800->write_urb=usb_alloc_urb (0, GFP_KERNEL));
/* Register the driver */ /* Register the driver */
if (usb_register (&mdc800_usb_driver) < 0) retval = usb_register(&mdc800_usb_driver);
if (retval)
goto cleanup_on_fail; goto cleanup_on_fail;
info (DRIVER_VERSION ":" DRIVER_DESC); info (DRIVER_VERSION ":" DRIVER_DESC);
...@@ -1031,11 +1033,11 @@ int __init usb_mdc800_init (void) ...@@ -1031,11 +1033,11 @@ int __init usb_mdc800_init (void)
kfree (mdc800); kfree (mdc800);
} }
mdc800=0; mdc800=0;
return -1; return retval;
} }
void __exit usb_mdc800_cleanup (void) static void __exit usb_mdc800_cleanup (void)
{ {
usb_deregister (&mdc800_usb_driver); usb_deregister (&mdc800_usb_driver);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment