linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] rtl8712: add a check for the status of register_netdev
@ 2018-12-26  2:39 Kangjie Lu
  2019-01-02 10:34 ` Dan Carpenter
  0 siblings, 1 reply; 2+ messages in thread
From: Kangjie Lu @ 2018-12-26  2:39 UTC (permalink / raw)
  To: kjlu
  Cc: pakki001, Larry Finger, Florian Schilhabel, Greg Kroah-Hartman,
	André Lehmann, devel, linux-kernel

register_netdev() may fail, so let's check its return value, and if it
fails, issue an error message.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 drivers/staging/rtl8712/hal_init.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8712/hal_init.c b/drivers/staging/rtl8712/hal_init.c
index 7cdd609cab6c..ca0858660a45 100644
--- a/drivers/staging/rtl8712/hal_init.c
+++ b/drivers/staging/rtl8712/hal_init.c
@@ -32,10 +32,10 @@
 static void rtl871x_load_fw_cb(const struct firmware *firmware, void *context)
 {
 	struct _adapter *padapter = context;
+	struct usb_device *udev = padapter->dvobjpriv.pusbdev;
 
 	complete(&padapter->rtl8712_fw_ready);
 	if (!firmware) {
-		struct usb_device *udev = padapter->dvobjpriv.pusbdev;
 		struct usb_interface *pusb_intf = padapter->pusb_intf;
 
 		dev_err(&udev->dev, "r8712u: Firmware request failed\n");
@@ -45,7 +45,8 @@ static void rtl871x_load_fw_cb(const struct firmware *firmware, void *context)
 	}
 	padapter->fw = firmware;
 	/* firmware available - start netdev */
-	register_netdev(padapter->pnetdev);
+	if (register_netdev(padapter->pnetdev))
+		dev_err(&udev->dev, "r8712u: Registering netdev failed\n");
 }
 
 static const char firmware_file[] = "rtlwifi/rtl8712u.bin";
-- 
2.17.2 (Apple Git-113)


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-01-02 10:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-26  2:39 [PATCH v2] rtl8712: add a check for the status of register_netdev Kangjie Lu
2019-01-02 10: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;
as well as URLs for NNTP newsgroup(s).