Commit 7dd9a40f authored by Toke Høiland-Jørgensen's avatar Toke Høiland-Jørgensen Committed by Kalle Valo
Browse files

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: 2f90c7e5 ("ath9k: Check for errors when reading SREV register")
Signed-off-by: default avatarToke Høiland-Jørgensen <toke@redhat.com>
Reviewed-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210326180819.142480-1-toke@redhat.com
parent afda3349
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);
+1 −1
Original line number Diff line number Diff line
@@ -286,7 +286,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;