Skip to contentSkip to conversation

rtw88: fix fw_fifo_addr check

PATCH In review [email protected] 4 participants 4 messages Oct 11, 2020 – Nov 2, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rtw88: fix fw_fifo_addr check

From: Tom Rix <[email protected]>

The clang build reports this warning

fw.c:1485:21: warning: address of array 'rtwdev->chip->fw_fifo_addr'
will always evaluate to 'true'

        if (!rtwdev->chip->fw_fifo_addr) {

fw_fifo_addr is an array in rtw_chip_info so it is always nonzero. A better check is if the first element of the array is nonzero. In the cases where fw_fifo_addr is initialized by rtw88b and rtw88c, the first array element is 0x780.

---
 drivers/net/wireless/realtek/rtw88/fw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw88/fw.c +1 -1
index 042015bc8055..b2fd87834f23 100644
@@ -1482,7 +1482,7 @@ static bool rtw_fw_dump_check_size(struct rtw_dev *rtwdev,
 int rtw_fw_dump_fifo(struct rtw_dev *rtwdev, u8 fifo_sel, u32 addr, u32 size,
 		     u32 *buffer)
 {
-	if (!rtwdev->chip->fw_fifo_addr) {
+	if (!rtwdev->chip->fw_fifo_addr[0]) {
 		rtw_dbg(rtwdev, RTW_DBG_FW, "chip not support dump fw fifo\n");
 		return -ENOTSUPP;
 	}
Signature · 1 line
2.18.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · On Sun, Oct 11, 2020 at 08:54:38AM -0700, [email protected] wrote:

From: Tom Rix <[email protected]>

The clang build reports this warning

fw.c:1485:21: warning: address of array 'rtwdev->chip->fw_fifo_addr'
will always evaluate to 'true'

Quoted 8 lines
        if (!rtwdev->chip->fw_fifo_addr) {

fw_fifo_addr is an array in rtw_chip_info so it is always nonzero. A better check is if the first element of the array is nonzero. In the cases where fw_fifo_addr is initialized by rtw88b and rtw88c, the first array element is 0x780.

Quoted 20 lines
---
 drivers/net/wireless/realtek/rtw88/fw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw88/fw.c +1 -1
index 042015bc8055..b2fd87834f23 100644
@@ -1482,7 +1482,7 @@ static bool rtw_fw_dump_check_size(struct rtw_dev *rtwdev,
 int rtw_fw_dump_fifo(struct rtw_dev *rtwdev, u8 fifo_sel, u32 addr, u32 size,
 		     u32 *buffer)
 {
-	if (!rtwdev->chip->fw_fifo_addr) {
+	if (!rtwdev->chip->fw_fifo_addr[0]) {
 		rtw_dbg(rtwdev, RTW_DBG_FW, "chip not support dump fw fifo\n");
 		return -ENOTSUPP;
 	}
Signature · 1 line
2.18.1
Acked-by
#2 lore raw
Quoted 10 lines · On Sun, Oct 11, 2020 at 08:54:38AM -0700, [email protected] wrote:
Quoted 8 lines

From: Tom Rix <[email protected]>

The clang build reports this warning

fw.c:1485:21: warning: address of array 'rtwdev->chip->fw_fifo_addr'
will always evaluate to 'true'

        if (!rtwdev->chip->fw_fifo_addr) {
Quoted 9 lines
Quoted 6 lines

fw_fifo_addr is an array in rtw_chip_info so it is always nonzero. A better check is if the first element of the array is nonzero. In the cases where fw_fifo_addr is initialized by rtw88b and rtw88c, the first array element is 0x780.

Thanks for your fix,

Quoted 24 lines
Quoted 11 lines
---
 drivers/net/wireless/realtek/rtw88/fw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw88/fw.c +0 -0
index 042015bc8055..b2fd87834f23 100644
@@ -1482,7 +1482,7 @@ static bool rtw_fw_dump_check_size(struct

rtw_dev *rtwdev, int rtw_fw_dump_fifo(struct rtw_dev *rtwdev, u8

fifo_sel, u32 addr, u32 size,

Quoted 10 lines
drivers/net/wireless/realtek/rtw88/fw.c +1 -2
 		     u32 *buffer)
 {
-	if (!rtwdev->chip->fw_fifo_addr) {
+	if (!rtwdev->chip->fw_fifo_addr[0]) {
 		rtw_dbg(rtwdev, RTW_DBG_FW, "chip not support dump fw fifo\n");
 		return -ENOTSUPP;
 	}
--

2.18.1

------Please consider the environment before printing this e-mail.

#3 lore raw
In reply to [email protected]
Quoted 13 lines · [email protected] wrote:

From: Tom Rix <[email protected]>

The clang build reports this warning

fw.c:1485:21: warning: address of array 'rtwdev->chip->fw_fifo_addr'
will always evaluate to 'true'

        if (!rtwdev->chip->fw_fifo_addr) {

fw_fifo_addr is an array in rtw_chip_info so it is always nonzero. A better check is if the first element of the array is nonzero. In the cases where fw_fifo_addr is initialized by rtw88b and rtw88c, the first array element is 0x780.

Quoted 4 lines
Fixes 0fbc2f0f34cc ("rtw88: add dump firmware fifo support")

Patch applied to wireless-drivers.git, thanks.

ddcd945e556e rtw88: fix fw_fifo_addr check

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

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