linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: wireless: ath9k: Return an error when ath9k_hw_reset() fails
@ 2019-05-04 10:08 Jia-Ju Bai
  2019-05-04 11:02 ` Heiner Kallweit
  0 siblings, 1 reply; 3+ messages in thread
From: Jia-Ju Bai @ 2019-05-04 10:08 UTC (permalink / raw)
  To: ath9k-devel, kvalo, davem
  Cc: linux-wireless, netdev, linux-kernel, Jia-Ju Bai

ath9k_hw_reset() in ath9k_start() can fail, and in this case, 
ath9k_start() should return an error instead of executing the 
subsequent code.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
---
 drivers/net/wireless/ath/ath9k/main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index f23cb2f3d296..f78e7c46764d 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -681,6 +681,7 @@ static int ath9k_start(struct ieee80211_hw *hw)
 			"Unable to reset hardware; reset status %d (freq %u MHz)\n",
 			r, curchan->center_freq);
 		ah->reset_power_on = false;
+		return r;
 	}
 
 	/* Setup our intr mask. */
-- 
2.17.0


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

* Re: [PATCH] net: wireless: ath9k: Return an error when ath9k_hw_reset() fails
  2019-05-04 10:08 [PATCH] net: wireless: ath9k: Return an error when ath9k_hw_reset() fails Jia-Ju Bai
@ 2019-05-04 11:02 ` Heiner Kallweit
  2019-05-06  8:24   ` Kalle Valo
  0 siblings, 1 reply; 3+ messages in thread
From: Heiner Kallweit @ 2019-05-04 11:02 UTC (permalink / raw)
  To: Jia-Ju Bai, ath9k-devel, kvalo, davem
  Cc: linux-wireless, netdev, linux-kernel

On 04.05.2019 12:08, Jia-Ju Bai wrote:
> ath9k_hw_reset() in ath9k_start() can fail, and in this case, 
> ath9k_start() should return an error instead of executing the 
> subsequent code.
> 
Such mechanical patches w/o understanding the code are always
problematic. Do you have any proof that this error is fatal?
I think it is not, else we wouldn't have this line:
ah->reset_power_on = false;
Also you should consider that a mutex and a spinlock are held.
Maybe changing the error message to a warning would be more
appropriate. But this I would leave to somebody being more
familiar with this driver.

> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
> ---
>  drivers/net/wireless/ath/ath9k/main.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
> index f23cb2f3d296..f78e7c46764d 100644
> --- a/drivers/net/wireless/ath/ath9k/main.c
> +++ b/drivers/net/wireless/ath/ath9k/main.c
> @@ -681,6 +681,7 @@ static int ath9k_start(struct ieee80211_hw *hw)
>  			"Unable to reset hardware; reset status %d (freq %u MHz)\n",
>  			r, curchan->center_freq);
>  		ah->reset_power_on = false;
> +		return r;
>  	}
>  
>  	/* Setup our intr mask. */
> 


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

* Re: [PATCH] net: wireless: ath9k: Return an error when ath9k_hw_reset() fails
  2019-05-04 11:02 ` Heiner Kallweit
@ 2019-05-06  8:24   ` Kalle Valo
  0 siblings, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2019-05-06  8:24 UTC (permalink / raw)
  To: Heiner Kallweit
  Cc: Jia-Ju Bai, ath9k-devel, davem, linux-wireless, netdev, linux-kernel

Heiner Kallweit <hkallweit1@gmail.com> writes:

> On 04.05.2019 12:08, Jia-Ju Bai wrote:
>> ath9k_hw_reset() in ath9k_start() can fail, and in this case, 
>> ath9k_start() should return an error instead of executing the 
>> subsequent code.
>> 
> Such mechanical patches w/o understanding the code are always
> problematic. Do you have any proof that this error is fatal?
> I think it is not, else we wouldn't have this line:
> ah->reset_power_on = false;
> Also you should consider that a mutex and a spinlock are held.
> Maybe changing the error message to a warning would be more
> appropriate. But this I would leave to somebody being more
> familiar with this driver.

A very good point, thanks Heiner! I will drop this unless someone
familiar with ath9k says that this is ok.

-- 
Kalle Valo

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

end of thread, other threads:[~2019-05-06  8:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-04 10:08 [PATCH] net: wireless: ath9k: Return an error when ath9k_hw_reset() fails Jia-Ju Bai
2019-05-04 11:02 ` Heiner Kallweit
2019-05-06  8:24   ` 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).