[PATCH] staging: rtl8712: check register_netdev() return value
From: shaojie . dong
Date: Sun Dec 06 2020 - 11:00:08 EST
From: "shaojie.dong" <shaojie.dong@xxxxxxxxxxxxxxxx>
Function register_netdev() can fail, so we should check it's return value
Signed-off-by: shaojie.dong <shaojie.dong@xxxxxxxxxxxxxxxx>
---
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