diff options
author | Peter Korsgaard <peter.korsgaard@barco.com> | 2010-04-26 08:05:06 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-05-20 20:21:40 (GMT) |
commit | da01c7a49bfc94dbfa66af5ca5e1063b10bc6a10 (patch) | |
tree | ec982308ce4b4339392309b901f01627f7f0ad6e /drivers/usb/gadget | |
parent | fe662b43521a8b8ad2dc79299922d0b0bb3fe728 (diff) | |
download | linux-fsl-qoriq-da01c7a49bfc94dbfa66af5ca5e1063b10bc6a10.tar.xz |
USB: g_hid: unregister platform driver on probe/usb_composite_register errors
Otherwise reloads will fail.
Signed-off-by: Peter Korsgaard <peter.korsgaard@barco.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r-- | drivers/usb/gadget/hid.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/usb/gadget/hid.c b/drivers/usb/gadget/hid.c index b77e977..7757226 100644 --- a/drivers/usb/gadget/hid.c +++ b/drivers/usb/gadget/hid.c @@ -275,8 +275,18 @@ MODULE_LICENSE("GPL"); static int __init hidg_init(void) { - platform_driver_probe(&hidg_plat_driver, hidg_plat_driver_probe); - return usb_composite_register(&hidg_driver); + int status; + + status = platform_driver_probe(&hidg_plat_driver, + hidg_plat_driver_probe); + if (status < 0) + return status; + + status = usb_composite_register(&hidg_driver); + if (status < 0) + platform_driver_unregister(&hidg_plat_driver); + + return status; } module_init(hidg_init); |