All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: r8188eu: drop return value from receive_disconnect
@ 2022-06-26 18:07 Martin Kaiser
  2022-06-26 20:45 ` Philipp Hortmann
  2022-06-27  9:06 ` Greg Kroah-Hartman
  0 siblings, 2 replies; 4+ messages in thread
From: Martin Kaiser @ 2022-06-26 18:07 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel, Martin Kaiser

The receive_disconnect function always returns _SUCCESS. None of the
callers checks the return value. We can remove it.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/core/rtw_mlme_ext.c    | 5 ++---
 drivers/staging/r8188eu/include/rtw_mlme_ext.h | 3 +--
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
index cce0575e93b7..fc6e06d7b5ca 100644
--- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
@@ -6191,14 +6191,14 @@ void start_clnt_assoc(struct adapter *padapter)
 	set_link_timer(pmlmeext, REASSOC_TO);
 }
 
-unsigned int receive_disconnect(struct adapter *padapter, unsigned char *MacAddr, unsigned short reason)
+void receive_disconnect(struct adapter *padapter, unsigned char *MacAddr, unsigned short reason)
 {
 	struct mlme_ext_priv	*pmlmeext = &padapter->mlmeextpriv;
 	struct mlme_ext_info	*pmlmeinfo = &pmlmeext->mlmext_info;
 
 	/* check A3 */
 	if (!(!memcmp(MacAddr, get_my_bssid(&pmlmeinfo->network), ETH_ALEN)))
-		return _SUCCESS;
+		return;
 
 	if ((pmlmeinfo->state & 0x03) == WIFI_FW_STATION_STATE) {
 		if (pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) {
@@ -6209,7 +6209,6 @@ unsigned int receive_disconnect(struct adapter *padapter, unsigned char *MacAddr
 			report_join_res(padapter, -2);
 		}
 	}
-	return _SUCCESS;
 }
 
 static void process_80211d(struct adapter *padapter, struct wlan_bssid_ex *bssid)
diff --git a/drivers/staging/r8188eu/include/rtw_mlme_ext.h b/drivers/staging/r8188eu/include/rtw_mlme_ext.h
index 71864733b1c0..56c0e584bb6c 100644
--- a/drivers/staging/r8188eu/include/rtw_mlme_ext.h
+++ b/drivers/staging/r8188eu/include/rtw_mlme_ext.h
@@ -468,8 +468,7 @@ unsigned int update_MSC_rate(struct HT_caps_element *pHT_caps);
 void Update_RA_Entry(struct adapter *padapter, u32 mac_id);
 void set_sta_rate(struct adapter *padapter, struct sta_info *psta);
 
-unsigned int receive_disconnect(struct adapter *padapter,
-				unsigned char *macaddr, unsigned short reason);
+void receive_disconnect(struct adapter *padapter, unsigned char *macaddr, unsigned short reason);
 
 unsigned char get_highest_rate_idx(u32 mask);
 int support_short_GI(struct adapter *padapter, struct HT_caps_element *caps);
-- 
2.30.2


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

* Re: [PATCH] staging: r8188eu: drop return value from receive_disconnect
  2022-06-26 18:07 [PATCH] staging: r8188eu: drop return value from receive_disconnect Martin Kaiser
@ 2022-06-26 20:45 ` Philipp Hortmann
  2022-06-27  9:06 ` Greg Kroah-Hartman
  1 sibling, 0 replies; 4+ messages in thread
From: Philipp Hortmann @ 2022-06-26 20:45 UTC (permalink / raw)
  To: Martin Kaiser, Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel

On 6/26/22 20:07, Martin Kaiser wrote:
> The receive_disconnect function always returns _SUCCESS. None of the
> callers checks the return value. We can remove it.
> 
> Signed-off-by: Martin Kaiser <martin@kaiser.cx>
> ---
>   drivers/staging/r8188eu/core/rtw_mlme_ext.c    | 5 ++---
>   drivers/staging/r8188eu/include/rtw_mlme_ext.h | 3 +--
>   2 files changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
> index cce0575e93b7..fc6e06d7b5ca 100644
> --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c
> +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
> @@ -6191,14 +6191,14 @@ void start_clnt_assoc(struct adapter *padapter)
>   	set_link_timer(pmlmeext, REASSOC_TO);
>   }
>   
> -unsigned int receive_disconnect(struct adapter *padapter, unsigned char *MacAddr, unsigned short reason)
> +void receive_disconnect(struct adapter *padapter, unsigned char *MacAddr, unsigned short reason)
>   {
>   	struct mlme_ext_priv	*pmlmeext = &padapter->mlmeextpriv;
>   	struct mlme_ext_info	*pmlmeinfo = &pmlmeext->mlmext_info;
>   
>   	/* check A3 */
>   	if (!(!memcmp(MacAddr, get_my_bssid(&pmlmeinfo->network), ETH_ALEN)))
> -		return _SUCCESS;
> +		return;
>   
>   	if ((pmlmeinfo->state & 0x03) == WIFI_FW_STATION_STATE) {
>   		if (pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) {
> @@ -6209,7 +6209,6 @@ unsigned int receive_disconnect(struct adapter *padapter, unsigned char *MacAddr
>   			report_join_res(padapter, -2);
>   		}
>   	}
> -	return _SUCCESS;
>   }
>   
>   static void process_80211d(struct adapter *padapter, struct wlan_bssid_ex *bssid)
> diff --git a/drivers/staging/r8188eu/include/rtw_mlme_ext.h b/drivers/staging/r8188eu/include/rtw_mlme_ext.h
> index 71864733b1c0..56c0e584bb6c 100644
> --- a/drivers/staging/r8188eu/include/rtw_mlme_ext.h
> +++ b/drivers/staging/r8188eu/include/rtw_mlme_ext.h
> @@ -468,8 +468,7 @@ unsigned int update_MSC_rate(struct HT_caps_element *pHT_caps);
>   void Update_RA_Entry(struct adapter *padapter, u32 mac_id);
>   void set_sta_rate(struct adapter *padapter, struct sta_info *psta);
>   
> -unsigned int receive_disconnect(struct adapter *padapter,
> -				unsigned char *macaddr, unsigned short reason);
> +void receive_disconnect(struct adapter *padapter, unsigned char *macaddr, unsigned short reason);
>   
>   unsigned char get_highest_rate_idx(u32 mask);
>   int support_short_GI(struct adapter *padapter, struct HT_caps_element *caps);

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150

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

* Re: [PATCH] staging: r8188eu: drop return value from receive_disconnect
  2022-06-26 18:07 [PATCH] staging: r8188eu: drop return value from receive_disconnect Martin Kaiser
  2022-06-26 20:45 ` Philipp Hortmann
@ 2022-06-27  9:06 ` Greg Kroah-Hartman
  2022-06-27 19:46   ` Martin Kaiser
  1 sibling, 1 reply; 4+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-27  9:06 UTC (permalink / raw)
  To: Martin Kaiser
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel

On Sun, Jun 26, 2022 at 08:07:34PM +0200, Martin Kaiser wrote:
> The receive_disconnect function always returns _SUCCESS. None of the
> callers checks the return value. We can remove it.
> 
> Signed-off-by: Martin Kaiser <martin@kaiser.cx>
> ---
>  drivers/staging/r8188eu/core/rtw_mlme_ext.c    | 5 ++---
>  drivers/staging/r8188eu/include/rtw_mlme_ext.h | 3 +--
>  2 files changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
> index cce0575e93b7..fc6e06d7b5ca 100644
> --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c
> +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
> @@ -6191,14 +6191,14 @@ void start_clnt_assoc(struct adapter *padapter)
>  	set_link_timer(pmlmeext, REASSOC_TO);
>  }
>  
> -unsigned int receive_disconnect(struct adapter *padapter, unsigned char *MacAddr, unsigned short reason)
> +void receive_disconnect(struct adapter *padapter, unsigned char *MacAddr, unsigned short reason)
>  {
>  	struct mlme_ext_priv	*pmlmeext = &padapter->mlmeextpriv;
>  	struct mlme_ext_info	*pmlmeinfo = &pmlmeext->mlmext_info;
>  
>  	/* check A3 */
>  	if (!(!memcmp(MacAddr, get_my_bssid(&pmlmeinfo->network), ETH_ALEN)))
> -		return _SUCCESS;
> +		return;

Shouldn't this check return an error instead of success?  If not, what
exactly is this checking this for?

thanks,

greg k-h

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

* Re: [PATCH] staging: r8188eu: drop return value from receive_disconnect
  2022-06-27  9:06 ` Greg Kroah-Hartman
@ 2022-06-27 19:46   ` Martin Kaiser
  0 siblings, 0 replies; 4+ messages in thread
From: Martin Kaiser @ 2022-06-27 19:46 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel

Hi Greg and all,

Thus wrote Greg Kroah-Hartman (gregkh@linuxfoundation.org):

> >  	/* check A3 */
> >  	if (!(!memcmp(MacAddr, get_my_bssid(&pmlmeinfo->network), ETH_ALEN)))
> > -		return _SUCCESS;
> > +		return;

> Shouldn't this check return an error instead of success?  If not, what
> exactly is this checking this for?

my understanding is that receive_disconnect is called when an access
point is no longer usable. This could be a deauth or disassoc message or
a beacon with incorrect info (so we assume the access point isn't
working any more).

The if statement checks if the notification is about the access point to
which we're connected. If not, we don't have to process the notification.
I guess this is not necessarily an error.

Thanks & Best regards,

   Martin

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

end of thread, other threads:[~2022-06-27 19:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-26 18:07 [PATCH] staging: r8188eu: drop return value from receive_disconnect Martin Kaiser
2022-06-26 20:45 ` Philipp Hortmann
2022-06-27  9:06 ` Greg Kroah-Hartman
2022-06-27 19:46   ` Martin Kaiser

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.