[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1528773525-37564-1-git-send-email-jiazhouyang09@gmail.com>
Date: Tue, 12 Jun 2018 11:18:43 +0800
From: Zhouyang Jia <jiazhouyang09@...il.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Zhouyang Jia <jiazhouyang09@...il.com>,
Larry Finger <Larry.Finger@...inger.net>,
Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Liam Ryan <liamryandev@...il.com>,
Colin Ian King <colin.king@...onical.com>,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: [PATCH] staging: rtl8712: add error handling for register_netdev
When register_netdev fails, the lack of error-handling code may
cause unexpected results.
This patch adds error-handling code after calling register_netdev.
Signed-off-by: Zhouyang Jia <jiazhouyang09@...il.com>
---
drivers/staging/rtl8712/hal_init.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/rtl8712/hal_init.c b/drivers/staging/rtl8712/hal_init.c
index 2a3f074..2b47e75 100644
--- a/drivers/staging/rtl8712/hal_init.c
+++ b/drivers/staging/rtl8712/hal_init.c
@@ -40,6 +40,7 @@
static void rtl871x_load_fw_cb(const struct firmware *firmware, void *context)
{
struct _adapter *padapter = context;
+ int rc;
complete(&padapter->rtl8712_fw_ready);
if (!firmware) {
@@ -53,7 +54,12 @@ static void rtl871x_load_fw_cb(const struct firmware *firmware, void *context)
}
padapter->fw = firmware;
/* firmware available - start netdev */
- register_netdev(padapter->pnetdev);
+ rc = register_netdev(padapter->pnetdev);
+ if (rc) {
+ struct usb_device *udev = padapter->dvobjpriv.pusbdev;
+
+ dev_err(&udev->dev, "r8712u: Unable to register netdev\n");
+ }
}
static const char firmware_file[] = "rtlwifi/rtl8712u.bin";
--
2.7.4
Powered by blists - more mailing lists