All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 5.6] rtw88: Fix return value of rtw_wow_check_fw_status
@ 2020-02-03  6:01 yhchuang
  2020-02-03  6:13 ` Nathan Chancellor
  2020-02-03 18:10 ` Kalle Valo
  0 siblings, 2 replies; 3+ messages in thread
From: yhchuang @ 2020-02-03  6:01 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, briannorris, natechancellor

From: Chin-Yen Lee <timlee@realtek.com>

Clang warns that ret is used uninitialzed.
And we found that actually the return type should be "int" instead
of "bool".

Fixes: 44bc17f7f5b3 ("rtw88: support wowlan feature for 8822c")
Link: https://github.com/ClangBuiltLinux/linux/issues/850
Reported-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Chin-Yen Lee <timlee@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
---
 drivers/net/wireless/realtek/rtw88/wow.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw88/wow.c b/drivers/net/wireless/realtek/rtw88/wow.c
index af5c27e1bb07..4820dca958dd 100644
--- a/drivers/net/wireless/realtek/rtw88/wow.c
+++ b/drivers/net/wireless/realtek/rtw88/wow.c
@@ -281,27 +281,26 @@ static void rtw_wow_rx_dma_start(struct rtw_dev *rtwdev)
 	rtw_write32_clr(rtwdev, REG_RXPKT_NUM, BIT_RW_RELEASE);
 }
 
-static bool rtw_wow_check_fw_status(struct rtw_dev *rtwdev, bool wow_enable)
+static int rtw_wow_check_fw_status(struct rtw_dev *rtwdev, bool wow_enable)
 {
-	bool ret;
-
 	/* wait 100ms for wow firmware to finish work */
 	msleep(100);
 
 	if (wow_enable) {
-		if (!rtw_read8(rtwdev, REG_WOWLAN_WAKE_REASON))
-			ret = 0;
+		if (rtw_read8(rtwdev, REG_WOWLAN_WAKE_REASON))
+			goto wow_fail;
 	} else {
-		if (rtw_read32_mask(rtwdev, REG_FE1IMR, BIT_FS_RXDONE) == 0 &&
-		    rtw_read32_mask(rtwdev, REG_RXPKT_NUM, BIT_RW_RELEASE) == 0)
-			ret = 0;
+		if (rtw_read32_mask(rtwdev, REG_FE1IMR, BIT_FS_RXDONE) ||
+		    rtw_read32_mask(rtwdev, REG_RXPKT_NUM, BIT_RW_RELEASE))
+			goto wow_fail;
 	}
 
-	if (ret)
-		rtw_err(rtwdev, "failed to check wow status %s\n",
-			wow_enable ? "enabled" : "disabled");
+	return 0;
 
-	return ret;
+wow_fail:
+	rtw_err(rtwdev, "failed to check wow status %s\n",
+		wow_enable ? "enabled" : "disabled");
+	return -EBUSY;
 }
 
 static void rtw_wow_fw_security_type_iter(struct ieee80211_hw *hw,
-- 
2.17.1


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

* Re: [PATCH 5.6] rtw88: Fix return value of rtw_wow_check_fw_status
  2020-02-03  6:01 [PATCH 5.6] rtw88: Fix return value of rtw_wow_check_fw_status yhchuang
@ 2020-02-03  6:13 ` Nathan Chancellor
  2020-02-03 18:10 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Nathan Chancellor @ 2020-02-03  6:13 UTC (permalink / raw)
  To: yhchuang; +Cc: kvalo, linux-wireless, briannorris

On Mon, Feb 03, 2020 at 02:01:57PM +0800, yhchuang@realtek.com wrote:
> From: Chin-Yen Lee <timlee@realtek.com>
> 
> Clang warns that ret is used uninitialzed.
> And we found that actually the return type should be "int" instead
> of "bool".
> 
> Fixes: 44bc17f7f5b3 ("rtw88: support wowlan feature for 8822c")
> Link: https://github.com/ClangBuiltLinux/linux/issues/850
> Reported-by: Nathan Chancellor <natechancellor@gmail.com>
> Signed-off-by: Chin-Yen Lee <timlee@realtek.com>
> Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>

Looks good to me, thank you for the fix and keeping my tags :)

Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Tested-by: Nathan Chancellor <natechancellor@gmail.com> # build

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

* Re: [PATCH 5.6] rtw88: Fix return value of rtw_wow_check_fw_status
  2020-02-03  6:01 [PATCH 5.6] rtw88: Fix return value of rtw_wow_check_fw_status yhchuang
  2020-02-03  6:13 ` Nathan Chancellor
@ 2020-02-03 18:10 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2020-02-03 18:10 UTC (permalink / raw)
  To: yhchuang; +Cc: linux-wireless, briannorris, natechancellor

<yhchuang@realtek.com> wrote:

> From: Chin-Yen Lee <timlee@realtek.com>
> 
> Clang warns that ret is used uninitialzed.
> And we found that actually the return type should be "int" instead
> of "bool".
> 
> Fixes: 44bc17f7f5b3 ("rtw88: support wowlan feature for 8822c")
> Link: https://github.com/ClangBuiltLinux/linux/issues/850
> Reported-by: Nathan Chancellor <natechancellor@gmail.com>
> Signed-off-by: Chin-Yen Lee <timlee@realtek.com>
> Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
> Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
> Tested-by: Nathan Chancellor <natechancellor@gmail.com> # build

Patch applied to wireless-drivers.git, thanks.

ebe8e6116ac4 rtw88: Fix return value of rtw_wow_check_fw_status

-- 
https://patchwork.kernel.org/patch/11362063/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

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

end of thread, other threads:[~2020-02-03 18:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-03  6:01 [PATCH 5.6] rtw88: Fix return value of rtw_wow_check_fw_status yhchuang
2020-02-03  6:13 ` Nathan Chancellor
2020-02-03 18:10 ` Kalle Valo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.