Skip to content

Commit

Permalink
staging: bcm: fix error handling in bcm_init()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alexey Khoroshilov authored and Greg Kroah-Hartman committed Sep 4, 2012
1 parent 1d200e8 commit d7b990a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion drivers/staging/bcm/InterfaceInit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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)
Expand Down

0 comments on commit d7b990a

Please sign in to comment.