]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
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>
Fri, 11 Nov 2011 17:35:36 +0000 (09:35 -0800)
commit 8582d86143c690c68cc42f996def466a035bee34 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/gadget/printer.c

index 271ef94668e719867d12c00a9ce9c1681c825f23..88a464cc96c08cc4ed96830366b89bf4e215bbae 100644 (file)
@@ -1602,7 +1602,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);
 }