diff mbox series

wifi: rtw88: add missing unwind goto for __rtw_download_firmware()

Message ID 20230607012741.10353-1-pkshih@realtek.com (mailing list archive)
State Accepted
Commit 91ccdbb94feadb0d8bf3b35c841b33ac95f2f45f
Delegated to: Kalle Valo
Headers show
Series wifi: rtw88: add missing unwind goto for __rtw_download_firmware() | expand

Commit Message

Ping-Ke Shih June 7, 2023, 1:27 a.m. UTC
This flaw is detected by smatch:
  drivers/net/wireless/realtek/rtw88/mac.c:748 __rtw_download_firmware()
  warn: missing unwind goto?

Though most things of dlfw_fail have been done by
download_firmware_end_flow() and wlan_cpu_enable(), an exception is that
download_firmware_end_flow() clear BIT_MCUFWDL_EN bit conditionally.
So, make this change to clear the bit.

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/r/202306052310.OVhcUjZ3-lkp@intel.com/
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 drivers/net/wireless/realtek/rtw88/mac.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Kalle Valo June 13, 2023, 8:37 a.m. UTC | #1
Ping-Ke Shih <pkshih@realtek.com> wrote:

> This flaw is detected by smatch:
>   drivers/net/wireless/realtek/rtw88/mac.c:748 __rtw_download_firmware()
>   warn: missing unwind goto?
> 
> Though most things of dlfw_fail have been done by
> download_firmware_end_flow() and wlan_cpu_enable(), an exception is that
> download_firmware_end_flow() clear BIT_MCUFWDL_EN bit conditionally.
> So, make this change to clear the bit.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Closes: https://lore.kernel.org/r/202306052310.OVhcUjZ3-lkp@intel.com/
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>

Patch applied to wireless-next.git, thanks.

91ccdbb94fea wifi: rtw88: add missing unwind goto for __rtw_download_firmware()
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtw88/mac.c b/drivers/net/wireless/realtek/rtw88/mac.c
index a168f36c38ece..298663b035808 100644
--- a/drivers/net/wireless/realtek/rtw88/mac.c
+++ b/drivers/net/wireless/realtek/rtw88/mac.c
@@ -794,8 +794,10 @@  static int __rtw_download_firmware(struct rtw_dev *rtwdev,
 
 	wlan_cpu_enable(rtwdev, true);
 
-	if (!ltecoex_reg_write(rtwdev, 0x38, ltecoex_bckp))
-		return -EBUSY;
+	if (!ltecoex_reg_write(rtwdev, 0x38, ltecoex_bckp)) {
+		ret = -EBUSY;
+		goto dlfw_fail;
+	}
 
 	ret = download_firmware_validate(rtwdev);
 	if (ret)