Skip to contentSkip to conversation

ath9k: Fix error check in ath9k_hw_read_revisions() for PCI devices

PATCH In review Toke Høiland-Jørgensen 3 participants 6 messages Mar 26, 2021 – Apr 22, 2021 Qualcomm Atheros ATH9K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ath9k: Fix error check in ath9k_hw_read_revisions() for PCI devices

When the error check in ath9k_hw_read_revisions() was added, it checked for -EIO which is what ath9k_regread() in the ath9k_htc driver uses. However, for plain ath9k, the register read function uses ioread32(), which just returns -1 on error. So if such a read fails, it still gets passed through and ends up as a weird mac revision in the log output.

Fix this by changing ath9k_regread() to return -1 on error like ioread32() does, and fix the error check to look for that instead of -EIO.

Fixes 2f90c7e5d094 ("ath9k: Check for errors when reading SREV register")
---
 drivers/net/wireless/ath/ath9k/htc_drv_init.c | 2 +-
 drivers/net/wireless/ath/ath9k/hw.c           | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath9k/htc_drv_init.c +1 -1
index db0c6fa9c9dc..ff61ae34ecdf 100644
@@ -246,7 +246,7 @@ static unsigned int ath9k_regread(void *hw_priv, u32 reg_offset)
 	if (unlikely(r)) {
 		ath_dbg(common, WMI, "REGISTER READ FAILED: (0x%04x, %d)\n",
 			reg_offset, r);
-		return -EIO;
+		return -1;
 	}
 
 	return be32_to_cpu(val);
drivers/net/wireless/ath/ath9k/hw.c +1 -1
index b66eeb577272..504e316d3394 100644
@@ -287,7 +287,7 @@ static bool ath9k_hw_read_revisions(struct ath_hw *ah)
 
 	srev = REG_READ(ah, AR_SREV);
 
-	if (srev == -EIO) {
+	if (srev == -1) {
 		ath_err(ath9k_hw_common(ah),
 			"Failed to read SREV register");
 		return false;
Signature · 1 line
2.31.0
#1 lore raw
Quoted 11 lines

When the error check in ath9k_hw_read_revisions() was added, it checked for -EIO which is what ath9k_regread() in the ath9k_htc driver uses. However, for plain ath9k, the register read function uses ioread32(), which just returns -1 on error. So if such a read fails, it still gets passed through and ends up as a weird mac revision in the log output.

Fix this by changing ath9k_regread() to return -1 on error like ioread32() does, and fix the error check to look for that instead of -EIO.

Fixes 2f90c7e5d094 ("ath9k: Check for errors when reading SREV register")

Hi Kalle

This patch is merged as "deferred" in patchwork - what's up with that?

-Toke

#2 lore raw
Quoted 9 lines · Toke Høiland-Jørgensen
Quoted 9 lines

When the error check in ath9k_hw_read_revisions() was added, it checked for -EIO which is what ath9k_regread() in the ath9k_htc driver uses. However, for plain ath9k, the register read function uses ioread32(), which just returns -1 on error. So if such a read fails, it still gets passed through and ends up as a weird mac revision in the log output.

Fix this by changing ath9k_regread() to return -1 on error like ioread32() does, and fix the error check to look for that instead of -EIO.

Quoted 6 lines
Quoted 2 lines
Fixes 2f90c7e5d094 ("ath9k: Check for errors when reading SREV register")

Hi Kalle

This patch is merged as "deferred" in patchwork - what's up with that?

Just lack of time on my part. Reviewed-by tags would help a lot :)

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#3 lore raw
Quoted 11 lines · Kalle Valo
Quoted 9 lines · Toke Høiland-Jørgensen
Quoted 9 lines

When the error check in ath9k_hw_read_revisions() was added, it checked for -EIO which is what ath9k_regread() in the ath9k_htc driver uses. However, for plain ath9k, the register read function uses ioread32(), which just returns -1 on error. So if such a read fails, it still gets passed through and ends up as a weird mac revision in the log output.

Fix this by changing ath9k_regread() to return -1 on error like ioread32() does, and fix the error check to look for that instead of -EIO.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Fixes 2f90c7e5d094 ("ath9k: Check for errors when reading SREV register")

Hi Kalle

This patch is merged as "deferred" in patchwork - what's up with that?

Just lack of time on my part. Reviewed-by tags would help a lot :)

Right, gotcha - will see if I can find someone to review :)

-Toke

Reviewed-by
#4 lore raw
In reply to Kalle Valo
Quoted 11 lines
Quoted 9 lines · Toke Høiland-Jørgensen
Quoted 9 lines

When the error check in ath9k_hw_read_revisions() was added, it checked for -EIO which is what ath9k_regread() in the ath9k_htc driver uses. However, for plain ath9k, the register read function uses ioread32(), which just returns -1 on error. So if such a read fails, it still gets passed through and ends up as a weird mac revision in the log output.

Fix this by changing ath9k_regread() to return -1 on error like ioread32() does, and fix the error check to look for that instead of -EIO.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Fixes 2f90c7e5d094 ("ath9k: Check for errors when reading SREV register")

Hi Kalle

This patch is merged as "deferred" in patchwork - what's up with that?

Just lack of time on my part. Reviewed-by tags would help a lot :)

Quoted 5 lines
Signature · 4 lines
-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#5 lore raw
In reply to Toke Høiland-Jørgensen
Quoted 6 lines · Toke Høiland-Jørgensen

When the error check in ath9k_hw_read_revisions() was added, it checked for -EIO which is what ath9k_regread() in the ath9k_htc driver uses. However, for plain ath9k, the register read function uses ioread32(), which just returns -1 on error. So if such a read fails, it still gets passed through and ends up as a weird mac revision in the log output.

Quoted 7 lines

Fix this by changing ath9k_regread() to return -1 on error like ioread32() does, and fix the error check to look for that instead of -EIO.

Fixes 2f90c7e5d094 ("ath9k: Check for errors when reading SREV register")

Patch applied to ath-next branch of ath.git, thanks.

7dd9a40fd6e0 ath9k: Fix error check in ath9k_hw_read_revisions() for PCI devices

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

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