Patchwork net: Checking usb_register() return value

login
register
mail settings
Submitter Marina Makienko
Date Aug. 14, 2012, 8:11 a.m.
Message ID <1344931890-15763-1-git-send-email-makienko@ispras.ru>
Download mbox | patch
Permalink /patch/177182/
State Not Applicable
Delegated to: David Miller
Headers show

Comments

Marina Makienko - Aug. 14, 2012, 8:11 a.m.
ath6kl_usb_init() does not check usb_register() return value.
As a result it may incorrectly report success of driver initialization.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Marina Makienko <makienko@ispras.ru>
---
 drivers/net/wireless/ath/ath6kl/usb.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
Kalle Valo - Aug. 14, 2012, 2:34 p.m.
On 08/14/2012 11:11 AM, Marina Makienko wrote:
> ath6kl_usb_init() does not check usb_register() return value.
> As a result it may incorrectly report success of driver initialization.
> 
> Found by Linux Driver Verification project (linuxtesting.org).
> 
> Signed-off-by: Marina Makienko <makienko@ispras.ru>

Thanks, applied to ath6kl.git. But I changed the title to use "ath6kl:"
and made some cosmetic changes to the code.

Kalle
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/wireless/ath/ath6kl/usb.c b/drivers/net/wireless/ath/ath6kl/usb.c
index 3740c3d..39f05da 100644
--- a/drivers/net/wireless/ath/ath6kl/usb.c
+++ b/drivers/net/wireless/ath/ath6kl/usb.c
@@ -1196,7 +1196,11 @@  static struct usb_driver ath6kl_usb_driver = {
 
 static int ath6kl_usb_init(void)
 {
-	usb_register(&ath6kl_usb_driver);
+	int ret = usb_register(&ath6kl_usb_driver);
+	if (ret) {
+		ath6kl_err("usb_register() failed: %d\n", ret);
+		return ret;
+	}
 	return 0;
 }