lkml.org 
[lkml]   [2012]   [Sep]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2] staging: bcm: fix error handling in bcm_init()
Date
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>
---
drivers/staging/bcm/InterfaceInit.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
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)
--
1.7.9.5


\
 
 \ /
  Last update: 2012-09-02 22:21    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site