Commit 31bc140b authored by Daniele Bellucci's avatar Daniele Bellucci Committed by Greg Kroah-Hartman

[PATCH] Audit and minor cleanups in drivers/usb/*

- audit video_register_device
- if usb_register fails report back its return code rather than -1
parent 351ff358
...@@ -354,15 +354,23 @@ static int usb_dsbr100_close(struct inode *inode, struct file *file) ...@@ -354,15 +354,23 @@ static int usb_dsbr100_close(struct inode *inode, struct file *file)
static int __init dsbr100_init(void) static int __init dsbr100_init(void)
{ {
int retval;
usb_dsbr100_radio.priv = NULL; usb_dsbr100_radio.priv = NULL;
usb_register(&usb_dsbr100_driver); retval = usb_register(&usb_dsbr100_driver);
if (video_register_device(&usb_dsbr100_radio, VFL_TYPE_RADIO, if (retval)
radio_nr)==-1) { goto failed_usb_register;
retval = video_register_device(&usb_dsbr100_radio, VFL_TYPE_RADIO,
radio_nr);
if (retval) {
warn("Couldn't register video device"); warn("Couldn't register video device");
return -EINVAL; goto failed_video_register;
} }
info(DRIVER_VERSION ":" DRIVER_DESC); info(DRIVER_VERSION ":" DRIVER_DESC);
return 0; return 0;
failed_video_register:
usb_deregister(&usb_dsbr100_driver);
failed_usb_register:
return retval;
} }
static void __exit dsbr100_exit(void) static void __exit dsbr100_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