Commit d7b990a0 authored by Alexey Khoroshilov's avatar Alexey Khoroshilov Committed by Greg Kroah-Hartman

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: default avatarAlexey Khoroshilov <khoroshilov@ispras.ru>
Acked-by: default avatarKevin McKinney <klmckinney1@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1d200e8d
......@@ -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)
......
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