linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ath9k: Fix error check in ath9k_hw_read_revisions() for PCI devices
@ 2021-03-26 18:08 Toke Høiland-Jørgensen
  2021-04-19 10:43 ` Toke Høiland-Jørgensen
  2021-04-22 13:38 ` Kalle Valo
  0 siblings, 2 replies; 6+ messages in thread
From: Toke Høiland-Jørgensen @ 2021-03-26 18:08 UTC (permalink / raw)
  To: linux-wireless; +Cc: 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.

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")
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
---
 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(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
index db0c6fa9c9dc..ff61ae34ecdf 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
@@ -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);
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index b66eeb577272..504e316d3394 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -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;
-- 
2.31.0


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

* Re: [PATCH] ath9k: Fix error check in ath9k_hw_read_revisions() for PCI devices
  2021-03-26 18:08 [PATCH] ath9k: Fix error check in ath9k_hw_read_revisions() for PCI devices Toke Høiland-Jørgensen
@ 2021-04-19 10:43 ` Toke Høiland-Jørgensen
  2021-04-21  9:09   ` Kalle Valo
  2021-04-22 13:38 ` Kalle Valo
  1 sibling, 1 reply; 6+ messages in thread
From: Toke Høiland-Jørgensen @ 2021-04-19 10:43 UTC (permalink / raw)
  To: Kalle Valo; +Cc: linux-wireless

> 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")
> Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>

Hi Kalle

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

-Toke


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

* Re: [PATCH] ath9k: Fix error check in ath9k_hw_read_revisions() for PCI devices
  2021-04-19 10:43 ` Toke Høiland-Jørgensen
@ 2021-04-21  9:09   ` Kalle Valo
  2021-04-21  9:36     ` Toke Høiland-Jørgensen
  2021-04-21 10:03     ` Lorenzo Bianconi
  0 siblings, 2 replies; 6+ messages in thread
From: Kalle Valo @ 2021-04-21  9:09 UTC (permalink / raw)
  To: Toke Høiland-Jørgensen; +Cc: linux-wireless

Toke Høiland-Jørgensen <toke@redhat.com> writes:

>> 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")
>> Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
>
> 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 :)

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

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

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

* Re: [PATCH] ath9k: Fix error check in ath9k_hw_read_revisions() for PCI devices
  2021-04-21  9:09   ` Kalle Valo
@ 2021-04-21  9:36     ` Toke Høiland-Jørgensen
  2021-04-21 10:03     ` Lorenzo Bianconi
  1 sibling, 0 replies; 6+ messages in thread
From: Toke Høiland-Jørgensen @ 2021-04-21  9:36 UTC (permalink / raw)
  To: Kalle Valo; +Cc: linux-wireless

Kalle Valo <kvalo@codeaurora.org> writes:

> Toke Høiland-Jørgensen <toke@redhat.com> writes:
>
>>> 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")
>>> Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
>>
>> 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


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

* Re: [PATCH] ath9k: Fix error check in ath9k_hw_read_revisions() for PCI devices
  2021-04-21  9:09   ` Kalle Valo
  2021-04-21  9:36     ` Toke Høiland-Jørgensen
@ 2021-04-21 10:03     ` Lorenzo Bianconi
  1 sibling, 0 replies; 6+ messages in thread
From: Lorenzo Bianconi @ 2021-04-21 10:03 UTC (permalink / raw)
  To: Kalle Valo; +Cc: Toke Høiland-Jørgensen, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 1132 bytes --]

> Toke Høiland-Jørgensen <toke@redhat.com> writes:
> 
> >> 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")
> >> Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
> >
> > 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 :)

Reviewed-by: Lorenzo Bianconi <lorenzo@kernel.org>

> 
> -- 
> https://patchwork.kernel.org/project/linux-wireless/list/
> 
> https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH] ath9k: Fix error check in ath9k_hw_read_revisions() for PCI devices
  2021-03-26 18:08 [PATCH] ath9k: Fix error check in ath9k_hw_read_revisions() for PCI devices Toke Høiland-Jørgensen
  2021-04-19 10:43 ` Toke Høiland-Jørgensen
@ 2021-04-22 13:38 ` Kalle Valo
  1 sibling, 0 replies; 6+ messages in thread
From: Kalle Valo @ 2021-04-22 13:38 UTC (permalink / raw)
  To: Toke Høiland-Jørgensen
  Cc: linux-wireless, Toke Høiland-Jørgensen

Toke Høiland-Jørgensen <toke@redhat.com> wrote:

> 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")
> Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
> Reviewed-by: Lorenzo Bianconi <lorenzo@kernel.org>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

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

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

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20210326180819.142480-1-toke@redhat.com/

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


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

end of thread, other threads:[~2021-04-22 13:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-26 18:08 [PATCH] ath9k: Fix error check in ath9k_hw_read_revisions() for PCI devices Toke Høiland-Jørgensen
2021-04-19 10:43 ` Toke Høiland-Jørgensen
2021-04-21  9:09   ` Kalle Valo
2021-04-21  9:36     ` Toke Høiland-Jørgensen
2021-04-21 10:03     ` Lorenzo Bianconi
2021-04-22 13:38 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).