USB: g_printer: fix bug in unregistration
authorFabian Godehardt <fg@emlix.com>
Thu, 1 Sep 2011 12:15:46 +0000 (14:15 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Sun, 18 Sep 2011 08:33:06 +0000 (01:33 -0700)
The allocated chardevice region range is only 1 device but on
unregister it currently tries to deregister 2.

Found this while doing a insmod/rmmod/insmod/rm... of the module
which seemed to eat major numbers.

Signed-off-by: Fabian Godehardt <fg@emlix.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/gadget/printer.c

index 68a0efbc2719f3c201c00e2497f5409193c18d6b..65a8834f274bf70020ed83eb9e340f1c3db544a8 100644 (file)
@@ -1594,7 +1594,7 @@ cleanup(void)
        if (status)
                ERROR(dev, "usb_gadget_unregister_driver %x\n", status);
 
-       unregister_chrdev_region(g_printer_devno, 2);
+       unregister_chrdev_region(g_printer_devno, 1);
        class_destroy(usb_gadget_class);
        mutex_unlock(&usb_printer_gadget.lock_printer_io);
 }