linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: shaojie.dong@isrc.iscas.ac.cn
To: Larry.Finger@lwfinger.net, florian.c.schilhabel@googlemail.com,
	gregkh@linuxfoundation.org
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	shaojie.dong@isrc.iscas.ac.cn
Subject: [PATCH] staging: rtl8712: check register_netdev() return value
Date: Sun,  6 Dec 2020 23:59:07 +0800	[thread overview]
Message-ID: <20201206155907.7991-1-shaojie.dong@isrc.iscas.ac.cn> (raw)

From: "shaojie.dong" <shaojie.dong@isrc.iscas.ac.cn>

Function register_netdev() can fail, so we should check it's return value

Signed-off-by: shaojie.dong <shaojie.dong@isrc.iscas.ac.cn>
---
 drivers/staging/rtl8712/hal_init.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8712/hal_init.c b/drivers/staging/rtl8712/hal_init.c
index 715f1fe8b..fbcc6de1b 100644
--- a/drivers/staging/rtl8712/hal_init.c
+++ b/drivers/staging/rtl8712/hal_init.c
@@ -45,7 +45,8 @@ static void rtl871x_load_fw_cb(const struct firmware *firmware, void *context)
 	}
 	adapter->fw = firmware;
 	/* firmware available - start netdev */
-	register_netdev(adapter->pnetdev);
+	if (register_netdev(adapter->pnetdev) != 0)
+		dev_err(&udev->dev, "r8712u: register_netdev() failed\n");
 	complete(&adapter->rtl8712_fw_ready);
 }
 
-- 
2.17.0


             reply	other threads:[~2020-12-06 16:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-06 15:59 shaojie.dong [this message]
2020-12-06 16:03 ` [PATCH] staging: rtl8712: check register_netdev() return value Greg KH
2020-12-06 17:10 ` kernel test robot
2020-12-09 15:01 shaojie.dong
2020-12-09 15:13 ` Greg KH
2020-12-09 17:46 ` 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=20201206155907.7991-1-shaojie.dong@isrc.iscas.ac.cn \
    --to=shaojie.dong@isrc.iscas.ac.cn \
    --cc=Larry.Finger@lwfinger.net \
    --cc=devel@driverdev.osuosl.org \
    --cc=florian.c.schilhabel@googlemail.com \
    --cc=gregkh@linuxfoundation.org \
    --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).