* [PATCH] staging: rtl8712: add error handling for register_netdev
@ 2018-06-12 3:18 Zhouyang Jia
2018-06-12 11:34 ` Dan Carpenter
0 siblings, 1 reply; 2+ messages in thread
From: Zhouyang Jia @ 2018-06-12 3:18 UTC (permalink / raw)
Cc: Zhouyang Jia, Larry Finger, Florian Schilhabel,
Greg Kroah-Hartman, Liam Ryan, Colin Ian King, devel,
linux-kernel
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@gmail.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
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] staging: rtl8712: add error handling for register_netdev
2018-06-12 3:18 [PATCH] staging: rtl8712: add error handling for register_netdev Zhouyang Jia
@ 2018-06-12 11:34 ` Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2018-06-12 11:34 UTC (permalink / raw)
To: Zhouyang Jia
Cc: Florian Schilhabel, devel, Greg Kroah-Hartman, linux-kernel,
Colin Ian King, Larry Finger
On Tue, Jun 12, 2018 at 11:18:43AM +0800, Zhouyang Jia wrote:
> When register_netdev fails, the lack of error-handling code may
> cause unexpected results.
>
> This patch adds error-handling code after calling register_netdev.
>
It doesn't add any error handling. It just adds an error message.
The error handling does look sort of messed up, but this isn't a useful
patch.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-06-12 11:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-12 3:18 [PATCH] staging: rtl8712: add error handling for register_netdev Zhouyang Jia
2018-06-12 11:34 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®