All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iwlegacy: Add missing check in il4965_commit_rxon
@ 2021-02-28 12:25 Dinghao Liu
  2021-03-01  7:25 ` Stanislaw Gruszka
  0 siblings, 1 reply; 3+ messages in thread
From: Dinghao Liu @ 2021-02-28 12:25 UTC (permalink / raw)
  To: dinghao.liu, kjlu
  Cc: Stanislaw Gruszka, Kalle Valo, David S. Miller, Jakub Kicinski,
	linux-wireless, netdev, linux-kernel

There is one il_set_tx_power() call in this function without
return value check. Print error message and return error code
on failure just like the other il_set_tx_power() call.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
---
 drivers/net/wireless/intel/iwlegacy/4965.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/intel/iwlegacy/4965.c b/drivers/net/wireless/intel/iwlegacy/4965.c
index 9fa556486511..3235b8be1894 100644
--- a/drivers/net/wireless/intel/iwlegacy/4965.c
+++ b/drivers/net/wireless/intel/iwlegacy/4965.c
@@ -1361,7 +1361,11 @@ il4965_commit_rxon(struct il_priv *il)
 		 * We do not commit tx power settings while channel changing,
 		 * do it now if tx power changed.
 		 */
-		il_set_tx_power(il, il->tx_power_next, false);
+		ret = il_set_tx_power(il, il->tx_power_next, false);
+		if (ret) {
+			IL_ERR("Error sending TX power (%d)\n", ret);
+			return ret;
+		}
 		return 0;
 	}
 
-- 
2.17.1


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

* Re: [PATCH] iwlegacy: Add missing check in il4965_commit_rxon
  2021-02-28 12:25 [PATCH] iwlegacy: Add missing check in il4965_commit_rxon Dinghao Liu
@ 2021-03-01  7:25 ` Stanislaw Gruszka
  2021-03-01  7:41   ` dinghao.liu
  0 siblings, 1 reply; 3+ messages in thread
From: Stanislaw Gruszka @ 2021-03-01  7:25 UTC (permalink / raw)
  To: Dinghao Liu
  Cc: kjlu, Kalle Valo, David S. Miller, Jakub Kicinski,
	linux-wireless, netdev, linux-kernel

On Sun, Feb 28, 2021 at 08:25:22PM +0800, Dinghao Liu wrote:
> There is one il_set_tx_power() call in this function without
> return value check. Print error message and return error code
> on failure just like the other il_set_tx_power() call.

We have few calls for il_set_tx_power(), on some cases we
check return on some not. That correct as setting tx power
can be deferred internally if not possible at the moment.

> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> ---
>  drivers/net/wireless/intel/iwlegacy/4965.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/intel/iwlegacy/4965.c b/drivers/net/wireless/intel/iwlegacy/4965.c
> index 9fa556486511..3235b8be1894 100644
> --- a/drivers/net/wireless/intel/iwlegacy/4965.c
> +++ b/drivers/net/wireless/intel/iwlegacy/4965.c
> @@ -1361,7 +1361,11 @@ il4965_commit_rxon(struct il_priv *il)
>  		 * We do not commit tx power settings while channel changing,
>  		 * do it now if tx power changed.
>  		 */
> -		il_set_tx_power(il, il->tx_power_next, false);
> +		ret = il_set_tx_power(il, il->tx_power_next, false);
> +		if (ret) {
> +			IL_ERR("Error sending TX power (%d)\n", ret);
> +			return ret;
> +		

This is not good change. We do not check return value of
il_commit_rxon(), except when creating interface. So this change might
broke creating interface, what worked otherwise when il_set_tx_power()
returned error.

Stanislaw

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

* Re: Re: [PATCH] iwlegacy: Add missing check in il4965_commit_rxon
  2021-03-01  7:25 ` Stanislaw Gruszka
@ 2021-03-01  7:41   ` dinghao.liu
  0 siblings, 0 replies; 3+ messages in thread
From: dinghao.liu @ 2021-03-01  7:41 UTC (permalink / raw)
  To: Stanislaw Gruszka
  Cc: kjlu, Kalle Valo, David S. Miller, Jakub Kicinski,
	linux-wireless, netdev, linux-kernel

> On Sun, Feb 28, 2021 at 08:25:22PM +0800, Dinghao Liu wrote:
> > There is one il_set_tx_power() call in this function without
> > return value check. Print error message and return error code
> > on failure just like the other il_set_tx_power() call.
> 
> We have few calls for il_set_tx_power(), on some cases we
> check return on some not. That correct as setting tx power
> can be deferred internally if not possible at the moment.
> 
> > Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> > ---
> >  drivers/net/wireless/intel/iwlegacy/4965.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/net/wireless/intel/iwlegacy/4965.c b/drivers/net/wireless/intel/iwlegacy/4965.c
> > index 9fa556486511..3235b8be1894 100644
> > --- a/drivers/net/wireless/intel/iwlegacy/4965.c
> > +++ b/drivers/net/wireless/intel/iwlegacy/4965.c
> > @@ -1361,7 +1361,11 @@ il4965_commit_rxon(struct il_priv *il)
> >  		 * We do not commit tx power settings while channel changing,
> >  		 * do it now if tx power changed.
> >  		 */
> > -		il_set_tx_power(il, il->tx_power_next, false);
> > +		ret = il_set_tx_power(il, il->tx_power_next, false);
> > +		if (ret) {
> > +			IL_ERR("Error sending TX power (%d)\n", ret);
> > +			return ret;
> > +		
> 
> This is not good change. We do not check return value of
> il_commit_rxon(), except when creating interface. So this change might
> broke creating interface, what worked otherwise when il_set_tx_power()
> returned error.
> 

It's clear to me, Thanks for your explanation!

Regards,
Dinghao

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

end of thread, other threads:[~2021-03-01  7:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-28 12:25 [PATCH] iwlegacy: Add missing check in il4965_commit_rxon Dinghao Liu
2021-03-01  7:25 ` Stanislaw Gruszka
2021-03-01  7:41   ` dinghao.liu

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.