Commit fad21bdf authored by Alan Stern's avatar Alan Stern Committed by Greg Kroah-Hartman

[PATCH] USB: Fix regression in core/devio.c

This patch (as551) fixes another little problem recently added to the
USB core.  Someone didn't fix the type of the first argument to
unregister_chrdev_region.
Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent fbf82fd2
...@@ -76,6 +76,8 @@ MODULE_PARM_DESC (usbfs_snoop, "true to log all usbfs traffic"); ...@@ -76,6 +76,8 @@ MODULE_PARM_DESC (usbfs_snoop, "true to log all usbfs traffic");
dev_info( dev , format , ## arg); \ dev_info( dev , format , ## arg); \
} while (0) } while (0)
#define USB_DEVICE_DEV MKDEV(USB_DEVICE_MAJOR, 0)
#define MAX_USBFS_BUFFER_SIZE 16384 #define MAX_USBFS_BUFFER_SIZE 16384
...@@ -1530,18 +1532,17 @@ int __init usbdev_init(void) ...@@ -1530,18 +1532,17 @@ int __init usbdev_init(void)
{ {
int retval; int retval;
retval = register_chrdev_region(MKDEV(USB_DEVICE_MAJOR, 0), retval = register_chrdev_region(USB_DEVICE_DEV, USB_DEVICE_MAX,
USB_DEVICE_MAX, "usb_device"); "usb_device");
if (retval) { if (retval) {
err("unable to register minors for usb_device"); err("unable to register minors for usb_device");
goto out; goto out;
} }
cdev_init(&usb_device_cdev, &usbfs_device_file_operations); cdev_init(&usb_device_cdev, &usbfs_device_file_operations);
retval = cdev_add(&usb_device_cdev, retval = cdev_add(&usb_device_cdev, USB_DEVICE_DEV, USB_DEVICE_MAX);
MKDEV(USB_DEVICE_MAJOR, 0), USB_DEVICE_MAX);
if (retval) { if (retval) {
err("unable to get usb_device major %d", USB_DEVICE_MAJOR); err("unable to get usb_device major %d", USB_DEVICE_MAJOR);
unregister_chrdev_region(USB_DEVICE_MAJOR, USB_DEVICE_MAX); unregister_chrdev_region(USB_DEVICE_DEV, USB_DEVICE_MAX);
goto out; goto out;
} }
usb_device_class = class_create(THIS_MODULE, "usb_device"); usb_device_class = class_create(THIS_MODULE, "usb_device");
...@@ -1550,7 +1551,7 @@ int __init usbdev_init(void) ...@@ -1550,7 +1551,7 @@ int __init usbdev_init(void)
retval = PTR_ERR(usb_device_class); retval = PTR_ERR(usb_device_class);
usb_device_class = NULL; usb_device_class = NULL;
cdev_del(&usb_device_cdev); cdev_del(&usb_device_cdev);
unregister_chrdev_region(USB_DEVICE_MAJOR, USB_DEVICE_MAX); unregister_chrdev_region(USB_DEVICE_DEV, USB_DEVICE_MAX);
} }
out: out:
...@@ -1561,6 +1562,6 @@ void usbdev_cleanup(void) ...@@ -1561,6 +1562,6 @@ void usbdev_cleanup(void)
{ {
class_destroy(usb_device_class); class_destroy(usb_device_class);
cdev_del(&usb_device_cdev); cdev_del(&usb_device_cdev);
unregister_chrdev_region(USB_DEVICE_MAJOR, USB_DEVICE_MAX); unregister_chrdev_region(USB_DEVICE_DEV, USB_DEVICE_MAX);
} }
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