mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] iwlwifi: mvm: Change an 'else if' into an 'else' in iwl_mvm_send_add_bcast_sta
@ 2019-03-08  0:03 Nathan Chancellor
  2019-03-08  0:08 ` Nick Desaulniers
  0 siblings, 1 reply; 3+ messages in thread
From: Nathan Chancellor @ 2019-03-08  0:03 UTC (permalink / raw)
  To: Johannes Berg, Emmanuel Grumbach, Luca Coelho,
	Intel Linux Wireless, Kalle Valo
  Cc: linux-wireless, netdev, linux-kernel, clang-built-linux,
	Nick Desaulniers, Nathan Chancellor

When building with -Wsometimes-uninitialized, Clang warns:

drivers/net/wireless/intel/iwlwifi/mvm/sta.c:2114:12: warning: variable
'queue' is used uninitialized whenever 'if' condition is false
[-Wsometimes-uninitialized]

Clang can't evaluate at this point that WARN(1, ...) always returns true
because __ret_warn_on is defined as !!(condition), which isn't
immediately evaluated as 1. Change this branch to else so that it's
clear to Clang that we intend to bail out here.

Link: https://github.com/ClangBuiltLinux/linux/issues/399
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
index 498c315291cf..360724ec41a6 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
@@ -2111,8 +2111,10 @@ int iwl_mvm_send_add_bcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
 			queue = mvm->probe_queue;
 		else if (vif->type == NL80211_IFTYPE_P2P_DEVICE)
 			queue = mvm->p2p_dev_queue;
-		else if (WARN(1, "Missing required TXQ for adding bcast STA\n"))
+		else {
+			WARN(1, "Missing required TXQ for adding bcast STA\n");
 			return -EINVAL;
+		}
 
 		bsta->tfd_queue_msk |= BIT(queue);
 
-- 
2.21.0


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

* Re: [PATCH] iwlwifi: mvm: Change an 'else if' into an 'else' in iwl_mvm_send_add_bcast_sta
  2019-03-08  0:03 [PATCH] iwlwifi: mvm: Change an 'else if' into an 'else' in iwl_mvm_send_add_bcast_sta Nathan Chancellor
@ 2019-03-08  0:08 ` Nick Desaulniers
  2019-03-11  7:45   ` Luca Coelho
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Desaulniers @ 2019-03-08  0:08 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Johannes Berg, Emmanuel Grumbach, Luca Coelho,
	Intel Linux Wireless, Kalle Valo, linux-wireless, netdev, LKML,
	clang-built-linux

On Thu, Mar 7, 2019 at 4:03 PM Nathan Chancellor
<natechancellor@gmail.com> wrote:
>
> When building with -Wsometimes-uninitialized, Clang warns:
>
> drivers/net/wireless/intel/iwlwifi/mvm/sta.c:2114:12: warning: variable
> 'queue' is used uninitialized whenever 'if' condition is false
> [-Wsometimes-uninitialized]
>
> Clang can't evaluate at this point that WARN(1, ...) always returns true
> because __ret_warn_on is defined as !!(condition), which isn't
> immediately evaluated as 1. Change this branch to else so that it's
> clear to Clang that we intend to bail out here.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/399
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>

Thanks for the simple fix.
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

> ---
>  drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
> index 498c315291cf..360724ec41a6 100644
> --- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
> +++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
> @@ -2111,8 +2111,10 @@ int iwl_mvm_send_add_bcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
>                         queue = mvm->probe_queue;
>                 else if (vif->type == NL80211_IFTYPE_P2P_DEVICE)
>                         queue = mvm->p2p_dev_queue;
> -               else if (WARN(1, "Missing required TXQ for adding bcast STA\n"))
> +               else {
> +                       WARN(1, "Missing required TXQ for adding bcast STA\n");
>                         return -EINVAL;
> +               }
>
>                 bsta->tfd_queue_msk |= BIT(queue);
>
> --
> 2.21.0
>


-- 
Thanks,
~Nick Desaulniers

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

* Re: [PATCH] iwlwifi: mvm: Change an 'else if' into an 'else' in iwl_mvm_send_add_bcast_sta
  2019-03-08  0:08 ` Nick Desaulniers
@ 2019-03-11  7:45   ` Luca Coelho
  0 siblings, 0 replies; 3+ messages in thread
From: Luca Coelho @ 2019-03-11  7:45 UTC (permalink / raw)
  To: Nick Desaulniers, Nathan Chancellor
  Cc: Johannes Berg, Emmanuel Grumbach, Intel Linux Wireless,
	Kalle Valo, linux-wireless, netdev, LKML, clang-built-linux

On Thu, 2019-03-07 at 16:08 -0800, Nick Desaulniers wrote:
> On Thu, Mar 7, 2019 at 4:03 PM Nathan Chancellor
> <natechancellor@gmail.com> wrote:
> > When building with -Wsometimes-uninitialized, Clang warns:
> > 
> > drivers/net/wireless/intel/iwlwifi/mvm/sta.c:2114:12: warning:
> > variable
> > 'queue' is used uninitialized whenever 'if' condition is false
> > [-Wsometimes-uninitialized]
> > 
> > Clang can't evaluate at this point that WARN(1, ...) always returns
> > true
> > because __ret_warn_on is defined as !!(condition), which isn't
> > immediately evaluated as 1. Change this branch to else so that it's
> > clear to Clang that we intend to bail out here.
> > 
> > Link: https://github.com/ClangBuiltLinux/linux/issues/399
> > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> 
> Thanks for the simple fix.
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

Thanks for the patch and for the review!

I have applied it in our internal tree and it will reach the mainline
following our normal upstreaming process.

--
Cheers,
Luca.


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

end of thread, other threads:[~2019-03-11  7:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-08  0:03 [PATCH] iwlwifi: mvm: Change an 'else if' into an 'else' in iwl_mvm_send_add_bcast_sta Nathan Chancellor
2019-03-08  0:08 ` Nick Desaulniers
2019-03-11  7:45   ` Luca Coelho

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®