diff options
author | Alexey Khoroshilov <khoroshilov@ispras.ru> | 2012-09-02 19:30:13 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-09-04 21:28:42 (GMT) |
commit | d7b990a035a86a07e81231caceb6e624056c258f (patch) | |
tree | cbb2c075ad29d7ff9b6f3c054f012e20259e12a8 /drivers/staging/bcm/InterfaceInit.c | |
parent | 1d200e8d0a53f419e89097b0fc197941228191c3 (diff) | |
download | linux-fsl-qoriq-d7b990a035a86a07e81231caceb6e624056c258f.tar.xz |
staging: bcm: fix error handling in bcm_init()
bcm_init() does not have proper error handling of usb_register().
The patch implements one.
Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Acked-by: Kevin McKinney <klmckinney1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/bcm/InterfaceInit.c')
-rw-r--r-- | drivers/staging/bcm/InterfaceInit.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/staging/bcm/InterfaceInit.c b/drivers/staging/bcm/InterfaceInit.c index 8f85de6..57452ef 100644 --- a/drivers/staging/bcm/InterfaceInit.c +++ b/drivers/staging/bcm/InterfaceInit.c @@ -669,6 +669,8 @@ struct class *bcm_class; static __init int bcm_init(void) { + int retval; + printk(KERN_INFO "%s: %s, %s\n", DRV_NAME, DRV_DESCRIPTION, DRV_VERSION); printk(KERN_INFO "%s\n", DRV_COPYRIGHT); @@ -678,7 +680,13 @@ static __init int bcm_init(void) return PTR_ERR(bcm_class); } - return usb_register(&usbbcm_driver); + retval = usb_register(&usbbcm_driver); + if (retval < 0) { + printk(KERN_ERR DRV_NAME ": could not register usb driver\n"); + class_destroy(bcm_class); + return retval; + } + return 0; } static __exit void bcm_exit(void) |