From: Zhouyang Jia <jiazhouyang09@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Zhouyang Jia <jiazhouyang09@gmail.com>,
Larry Finger <Larry.Finger@lwfinger.net>,
Florian Schilhabel <florian.c.schilhabel@googlemail.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Liam Ryan <liamryandev@gmail.com>,
Colin Ian King <colin.king@canonical.com>,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: [PATCH] staging: rtl8712: add error handling for register_netdev
Date: Tue, 12 Jun 2018 11:18:43 +0800 [thread overview]
Message-ID: <1528773525-37564-1-git-send-email-jiazhouyang09@gmail.com> (raw)
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
next reply other threads:[~2018-06-12 3:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-12 3:18 Zhouyang Jia [this message]
2018-06-12 11:34 ` Dan Carpenter
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=1528773525-37564-1-git-send-email-jiazhouyang09@gmail.com \
--to=jiazhouyang09@gmail.com \
--cc=Larry.Finger@lwfinger.net \
--cc=colin.king@canonical.com \
--cc=devel@driverdev.osuosl.org \
--cc=florian.c.schilhabel@googlemail.com \
--cc=gregkh@linuxfoundation.org \
--cc=liamryandev@gmail.com \
--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
all inboxes | Powered by JetHome®