All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: wireless: wcn36xx: Handle scan initialization error
@ 2021-05-25 16:05 Loic Poulain
  2021-06-12 10:55 ` Kalle Valo
  0 siblings, 1 reply; 2+ messages in thread
From: Loic Poulain @ 2021-05-25 16:05 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, wcn36xx, Loic Poulain

In case firmware is not able to initialize scanning, return
an error to skip scanning on the channel. Scan initialization
can fail, if e.g. the firmware is not able to submit the null
function packet with PS bit set.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
---
 drivers/net/wireless/ath/wcn36xx/main.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
index eaa38d3..c99c670 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -433,8 +433,11 @@ static int wcn36xx_config(struct ieee80211_hw *hw, u32 changed)
 			/* A scan is ongoing, do not change the operating
 			 * channel, but start a scan session on the channel.
 			 */
-			wcn36xx_smd_init_scan(wcn, HAL_SYS_MODE_SCAN,
-					      wcn->sw_scan_vif);
+			if (wcn36xx_smd_init_scan(wcn, HAL_SYS_MODE_SCAN,
+						  wcn->sw_scan_vif)) {
+				mutex_unlock(&wcn->conf_mutex);
+				return -EIO;
+			}
 			wcn36xx_smd_start_scan(wcn, ch);
 		} else {
 			wcn36xx_change_opchannel(wcn, ch);
-- 
2.7.4


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

* Re: [PATCH] net: wireless: wcn36xx: Handle scan initialization error
  2021-05-25 16:05 [PATCH] net: wireless: wcn36xx: Handle scan initialization error Loic Poulain
@ 2021-06-12 10:55 ` Kalle Valo
  0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2021-06-12 10:55 UTC (permalink / raw)
  To: Loic Poulain; +Cc: linux-wireless, wcn36xx

Loic Poulain <loic.poulain@linaro.org> writes:

> In case firmware is not able to initialize scanning, return
> an error to skip scanning on the channel. Scan initialization
> can fail, if e.g. the firmware is not able to submit the null
> function packet with PS bit set.
>
> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

No "net: wireless:" in the title, please.

> --- a/drivers/net/wireless/ath/wcn36xx/main.c
> +++ b/drivers/net/wireless/ath/wcn36xx/main.c
> @@ -433,8 +433,11 @@ static int wcn36xx_config(struct ieee80211_hw *hw, u32 changed)
>  			/* A scan is ongoing, do not change the operating
>  			 * channel, but start a scan session on the channel.
>  			 */
> -			wcn36xx_smd_init_scan(wcn, HAL_SYS_MODE_SCAN,
> -					      wcn->sw_scan_vif);
> +			if (wcn36xx_smd_init_scan(wcn, HAL_SYS_MODE_SCAN,
> +						  wcn->sw_scan_vif)) {
> +				mutex_unlock(&wcn->conf_mutex);
> +				return -EIO;
> +			}

Why are you rewriting the error code from wcn36xx_smd_init_scan()?

Also I think this style is more readable (which does not rewrite the
error code either):

ret = foo();
if (ret) {
    ...
}

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

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

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

end of thread, other threads:[~2021-06-12 10:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-25 16:05 [PATCH] net: wireless: wcn36xx: Handle scan initialization error Loic Poulain
2021-06-12 10:55 ` Kalle Valo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.