diff mbox series

wifi: iwlwifi: mvm: fix an error code in iwl_mvm_mld_add_sta()

Message ID 75e4ea09-db58-462f-bd4e-5ad4e5e5dcb5@moroto.mountain
State New
Headers show
Series wifi: iwlwifi: mvm: fix an error code in iwl_mvm_mld_add_sta() | expand

Commit Message

Dan Carpenter Sept. 27, 2023, 12:40 p.m. UTC
This error path should return -EINVAL instead of success.

Fixes: 57974a55d995 ("wifi: iwlwifi: mvm: refactor iwl_mvm_mac_sta_state_common()")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
I copy and pasted this approach from similar code in the same patch.

 drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Dan Carpenter Oct. 26, 2023, 10:42 a.m. UTC | #1
Ping?

regards,
dan carpenter

On Wed, Sep 27, 2023 at 03:40:41PM +0300, Dan Carpenter wrote:
> This error path should return -EINVAL instead of success.
> 
> Fixes: 57974a55d995 ("wifi: iwlwifi: mvm: refactor iwl_mvm_mac_sta_state_common()")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> I copy and pasted this approach from similar code in the same patch.
> 
>  drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c
> index 1464aad039e1..f2e952481ff8 100644
> --- a/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c
> +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c
> @@ -707,8 +707,10 @@ int iwl_mvm_mld_add_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
>  			rcu_dereference_protected(mvm_sta->link[link_id],
>  						  lockdep_is_held(&mvm->mutex));
>  
> -		if (WARN_ON(!link_conf || !mvm_link_sta))
> +		if (WARN_ON(!link_conf || !mvm_link_sta)) {
> +			ret = -EINVAL;
>  			goto err;
> +		}
>  
>  		ret = iwl_mvm_mld_cfg_sta(mvm, sta, vif, link_sta, link_conf,
>  					  mvm_link_sta);
> -- 
> 2.39.2
Miri Korenblit Oct. 26, 2023, 10:44 a.m. UTC | #2
Hi

Sorry for the delay,
I am fixing it.

Thanks,
Miri

Miri Korenblit | CCG | WCS | WCD
Office: +972 2 589-7724 | Cell Phone: +972 54 846 3803

-----Original Message-----
From: Dan Carpenter <dan.carpenter@linaro.org> 
Sent: Thursday, October 26, 2023 13:42
To: Greenman, Gregory <gregory.greenman@intel.com>
Cc: Kalle Valo <kvalo@kernel.org>; Berg, Johannes <johannes.berg@intel.com>; Korenblit, Miriam Rachel <miriam.rachel.korenblit@intel.com>; Triebitz, Shaul <shaul.triebitz@intel.com>; linux-wireless@vger.kernel.org; kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] wifi: iwlwifi: mvm: fix an error code in iwl_mvm_mld_add_sta()

Ping?

regards,
dan carpenter

On Wed, Sep 27, 2023 at 03:40:41PM +0300, Dan Carpenter wrote:
> This error path should return -EINVAL instead of success.
> 
> Fixes: 57974a55d995 ("wifi: iwlwifi: mvm: refactor iwl_mvm_mac_sta_state_common()")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> I copy and pasted this approach from similar code in the same patch.
> 
>  drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c
> index 1464aad039e1..f2e952481ff8 100644
> --- a/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c
> +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c
> @@ -707,8 +707,10 @@ int iwl_mvm_mld_add_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
>  			rcu_dereference_protected(mvm_sta->link[link_id],
>  						  lockdep_is_held(&mvm->mutex));
>  
> -		if (WARN_ON(!link_conf || !mvm_link_sta))
> +		if (WARN_ON(!link_conf || !mvm_link_sta)) {
> +			ret = -EINVAL;
>  			goto err;
> +		}
>  
>  		ret = iwl_mvm_mld_cfg_sta(mvm, sta, vif, link_sta, link_conf,
>  					  mvm_link_sta);
> -- 
> 2.39.2
---------------------------------------------------------------------
A member of the Intel Corporation group of companies

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
Greenman, Gregory Oct. 26, 2023, 2:09 p.m. UTC | #3
On Thu, 2023-10-26 at 13:42 +0300, Dan Carpenter wrote:
> Ping?
> 
> regards,
> dan carpenter
> 
> On Wed, Sep 27, 2023 at 03:40:41PM +0300, Dan Carpenter wrote:
> > This error path should return -EINVAL instead of success.
> > 
> > Fixes: 57974a55d995 ("wifi: iwlwifi: mvm: refactor iwl_mvm_mac_sta_state_common()")
> > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> > ---
> > I copy and pasted this approach from similar code in the same patch.
> > 
> >  drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c
> > index 1464aad039e1..f2e952481ff8 100644
> > --- a/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c
> > +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c
> > @@ -707,8 +707,10 @@ int iwl_mvm_mld_add_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
> >                         rcu_dereference_protected(mvm_sta->link[link_id],
> >                                                   lockdep_is_held(&mvm->mutex));
> >  
> > -               if (WARN_ON(!link_conf || !mvm_link_sta))
> > +               if (WARN_ON(!link_conf || !mvm_link_sta)) {
> > +                       ret = -EINVAL;
> >                         goto err;
> > +               }
> >  
> >                 ret = iwl_mvm_mld_cfg_sta(mvm, sta, vif, link_sta, link_conf,
> >                                           mvm_link_sta);
> > -- 
> > 2.39.2

Thanks for the fix.
Acked-by: Gregory Greenman <gregory.greenman@intel.com>
diff mbox series

Patch

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c
index 1464aad039e1..f2e952481ff8 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c
@@ -707,8 +707,10 @@  int iwl_mvm_mld_add_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
 			rcu_dereference_protected(mvm_sta->link[link_id],
 						  lockdep_is_held(&mvm->mutex));
 
-		if (WARN_ON(!link_conf || !mvm_link_sta))
+		if (WARN_ON(!link_conf || !mvm_link_sta)) {
+			ret = -EINVAL;
 			goto err;
+		}
 
 		ret = iwl_mvm_mld_cfg_sta(mvm, sta, vif, link_sta, link_conf,
 					  mvm_link_sta);