From: Alexey Khoroshilov <khoroshilov@ispras.ru>
To: Kevin McKinney <klmckinney1@gmail.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Alexey Khoroshilov <khoroshilov@ispras.ru>,
Dan Carpenter <dan.carpenter@oracle.com>,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
ldv-project@ispras.ru
Subject: [PATCH v2] staging: bcm: fix error handling in bcm_init()
Date: Sun, 2 Sep 2012 23:30:13 +0400 [thread overview]
Message-ID: <1346614214-14340-1-git-send-email-khoroshilov@ispras.ru> (raw)
In-Reply-To: <20120902165130.GA3952@gmail.com>
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
next prev parent reply other threads:[~2012-09-02 19:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-01 21:37 [PATCH] staging: bcm: fix error handling in bcm_init() Alexey Khoroshilov
2012-09-02 16:51 ` Kevin McKinney
2012-09-02 19:30 ` Alexey Khoroshilov [this message]
2012-09-02 19:30 ` [PATCH] staging: bcm: use pr_info and pr_err rather than printk Alexey Khoroshilov
2012-09-02 20:42 ` Kevin McKinney
2012-09-02 20:38 ` [PATCH v2] staging: bcm: fix error handling in bcm_init() Kevin McKinney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1346614214-14340-1-git-send-email-khoroshilov@ispras.ru \
--to=khoroshilov@ispras.ru \
--cc=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=klmckinney1@gmail.com \
--cc=ldv-project@ispras.ru \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).