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.
Unified · Split
| @@ -794,8 +794,10 @@ static int __rtw_download_firmware(struct rtw_dev *rtwdev, · 793 unmodified lines | ||
| 794 | 794 | |
| 795 | 795 | wlan_cpu_enable(rtwdev, true); |
| 796 | 796 | |
| 797 | − if (!ltecoex_reg_write(rtwdev, 0x38, ltecoex_bckp)) | |
| 798 | − return -EBUSY; | |
| 797 | + if (!ltecoex_reg_write(rtwdev, 0x38, ltecoex_bckp)) { | |
| 798 | + ret = -EBUSY; | |
| 799 | + goto dlfw_fail; | |
| 800 | + } | |
| 799 | 801 | |
| 800 | 802 | ret = download_firmware_validate(rtwdev); |
| 801 | 803 | if (ret) |