ChangeSet 1.1757.66.14, 2004/07/14 14:47:56-07:00, [EMAIL PROTECTED]

[PATCH] USB: usb/core/file.c::usb_major_init() cleanup.

 This patch does a cleanup for usb/core/file.c::usb_major_init(), which
 is:

*) in error condition, returns the error code from register_chrdev(),
   insted returning -EBUSY;

*) adds missing audit for class_register();

*) only calls devfs_mk_dir() if the prior calls have success.


Signed-off-by: Luiz Capitulino <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>


 drivers/usb/core/file.c |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)


diff -Nru a/drivers/usb/core/file.c b/drivers/usb/core/file.c
--- a/drivers/usb/core/file.c   2004-07-14 16:45:09 -07:00
+++ b/drivers/usb/core/file.c   2004-07-14 16:45:09 -07:00
@@ -79,14 +79,25 @@
 
 int usb_major_init(void)
 {
-       if (register_chrdev(USB_MAJOR, "usb", &usb_fops)) {
+       int error;
+
+       error = register_chrdev(USB_MAJOR, "usb", &usb_fops);
+       if (error) {
                err("unable to get major %d for usb devices", USB_MAJOR);
-               return -EBUSY;
+               goto out;
+       }
+
+       error = class_register(&usb_class);
+       if (error) {
+               err("class_register failed for usb devices");
+               unregister_chrdev(USB_MAJOR, "usb");
+               goto out;
        }
 
        devfs_mk_dir("usb");
-       class_register(&usb_class);
-       return 0;
+
+out:
+       return error;
 }
 
 void usb_major_cleanup(void)



-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_idG21&alloc_id040&op=click
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to