linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: r8188eu: change return type of rtw_set_802_11_disassociate to void
@ 2022-11-02 23:36 Phillip Potter
  2022-11-03  5:37 ` Michael Straube
  0 siblings, 1 reply; 3+ messages in thread
From: Phillip Potter @ 2022-11-02 23:36 UTC (permalink / raw)
  To: gregkh; +Cc: Larry.Finger, paskripkin, linux-staging, linux-kernel

Change return type of rtw_set_802_11_disassociate to void. This function
always returns 'true' no matter what, so there is no need to return a
value, and no need to check for it in the two call sites within
rtw_wx_set_mlme.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
---
 drivers/staging/r8188eu/core/rtw_ioctl_set.c    | 4 +---
 drivers/staging/r8188eu/include/rtw_ioctl_set.h | 2 +-
 drivers/staging/r8188eu/os_dep/ioctl_linux.c    | 6 ++----
 3 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_ioctl_set.c b/drivers/staging/r8188eu/core/rtw_ioctl_set.c
index 786431826659..785c0dba508f 100644
--- a/drivers/staging/r8188eu/core/rtw_ioctl_set.c
+++ b/drivers/staging/r8188eu/core/rtw_ioctl_set.c
@@ -314,7 +314,7 @@ u8 rtw_set_802_11_infrastructure_mode(struct adapter *padapter,
 	return true;
 }
 
-u8 rtw_set_802_11_disassociate(struct adapter *padapter)
+void rtw_set_802_11_disassociate(struct adapter *padapter)
 {
 	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
 
@@ -328,8 +328,6 @@ u8 rtw_set_802_11_disassociate(struct adapter *padapter)
 	}
 
 	spin_unlock_bh(&pmlmepriv->lock);
-
-	return true;
 }
 
 u8 rtw_set_802_11_bssid_list_scan(struct adapter *padapter, struct ndis_802_11_ssid *pssid, int ssid_max_num)
diff --git a/drivers/staging/r8188eu/include/rtw_ioctl_set.h b/drivers/staging/r8188eu/include/rtw_ioctl_set.h
index abe460d6504d..c3eb2479f27b 100644
--- a/drivers/staging/r8188eu/include/rtw_ioctl_set.h
+++ b/drivers/staging/r8188eu/include/rtw_ioctl_set.h
@@ -12,7 +12,7 @@ u8 rtw_set_802_11_authentication_mode(struct adapter *adapt,
 				      enum ndis_802_11_auth_mode authmode);
 u8 rtw_set_802_11_bssid(struct adapter *adapter, u8 *bssid);
 u8 rtw_set_802_11_add_wep(struct adapter *adapter, struct ndis_802_11_wep *wep);
-u8 rtw_set_802_11_disassociate(struct adapter *adapter);
+void rtw_set_802_11_disassociate(struct adapter *adapter);
 u8 rtw_set_802_11_bssid_list_scan(struct adapter *adapter,
 				  struct ndis_802_11_ssid *pssid,
 				  int ssid_max_num);
diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
index dda48a2a6d0c..04d9384d239a 100644
--- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
@@ -1020,12 +1020,10 @@ static int rtw_wx_set_mlme(struct net_device *dev,
 
 	switch (mlme->cmd) {
 	case IW_MLME_DEAUTH:
-		if (!rtw_set_802_11_disassociate(padapter))
-			ret = -1;
+		rtw_set_802_11_disassociate(padapter);
 		break;
 	case IW_MLME_DISASSOC:
-		if (!rtw_set_802_11_disassociate(padapter))
-			ret = -1;
+		rtw_set_802_11_disassociate(padapter);
 		break;
 	default:
 		return -EOPNOTSUPP;
-- 
2.38.1


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

* Re: [PATCH] staging: r8188eu: change return type of rtw_set_802_11_disassociate to void
  2022-11-02 23:36 [PATCH] staging: r8188eu: change return type of rtw_set_802_11_disassociate to void Phillip Potter
@ 2022-11-03  5:37 ` Michael Straube
  2022-11-03 22:53   ` Phillip Potter
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Straube @ 2022-11-03  5:37 UTC (permalink / raw)
  To: Phillip Potter, gregkh
  Cc: Larry.Finger, paskripkin, linux-staging, linux-kernel

Hi Phillip,

On 11/3/22 00:36, Phillip Potter wrote:
> Change return type of rtw_set_802_11_disassociate to void. This function
> always returns 'true' no matter what, so there is no need to return a
> value, and no need to check for it in the two call sites within
> rtw_wx_set_mlme.
> 
> Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
> ---
>   drivers/staging/r8188eu/core/rtw_ioctl_set.c    | 4 +---
>   drivers/staging/r8188eu/include/rtw_ioctl_set.h | 2 +-
>   drivers/staging/r8188eu/os_dep/ioctl_linux.c    | 6 ++----
>   3 files changed, 4 insertions(+), 8 deletions(-)
> 

<snip>

> --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c
> +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
> @@ -1020,12 +1020,10 @@ static int rtw_wx_set_mlme(struct net_device *dev,
>   
>   	switch (mlme->cmd) {
>   	case IW_MLME_DEAUTH:
> -		if (!rtw_set_802_11_disassociate(padapter))
> -			ret = -1;
> +		rtw_set_802_11_disassociate(padapter);
>   		break;
>   	case IW_MLME_DISASSOC:
> -		if (!rtw_set_802_11_disassociate(padapter))
> -			ret = -1;
> +		rtw_set_802_11_disassociate(padapter);
>   		break;
>   	default:
>   		return -EOPNOTSUPP;

You could also remove the ret variable and return 0 directly, since ret
is not changed anymore in the function.

regards,
Michael

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

* Re: [PATCH] staging: r8188eu: change return type of rtw_set_802_11_disassociate to void
  2022-11-03  5:37 ` Michael Straube
@ 2022-11-03 22:53   ` Phillip Potter
  0 siblings, 0 replies; 3+ messages in thread
From: Phillip Potter @ 2022-11-03 22:53 UTC (permalink / raw)
  To: Michael Straube
  Cc: gregkh, Larry.Finger, paskripkin, linux-staging, linux-kernel

On Thu, Nov 03, 2022 at 06:37:38AM +0100, Michael Straube wrote:
> Hi Phillip,
> 
> On 11/3/22 00:36, Phillip Potter wrote:
> > Change return type of rtw_set_802_11_disassociate to void. This function
> > always returns 'true' no matter what, so there is no need to return a
> > value, and no need to check for it in the two call sites within
> > rtw_wx_set_mlme.
> > 
> > Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
> > ---
> >   drivers/staging/r8188eu/core/rtw_ioctl_set.c    | 4 +---
> >   drivers/staging/r8188eu/include/rtw_ioctl_set.h | 2 +-
> >   drivers/staging/r8188eu/os_dep/ioctl_linux.c    | 6 ++----
> >   3 files changed, 4 insertions(+), 8 deletions(-)
> > 
> 
> <snip>
> 
> > --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c
> > +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
> > @@ -1020,12 +1020,10 @@ static int rtw_wx_set_mlme(struct net_device *dev,
> >   	switch (mlme->cmd) {
> >   	case IW_MLME_DEAUTH:
> > -		if (!rtw_set_802_11_disassociate(padapter))
> > -			ret = -1;
> > +		rtw_set_802_11_disassociate(padapter);
> >   		break;
> >   	case IW_MLME_DISASSOC:
> > -		if (!rtw_set_802_11_disassociate(padapter))
> > -			ret = -1;
> > +		rtw_set_802_11_disassociate(padapter);
> >   		break;
> >   	default:
> >   		return -EOPNOTSUPP;
> 
> You could also remove the ret variable and return 0 directly, since ret
> is not changed anymore in the function.
> 
> regards,
> Michael

Hi Michael,

Thanks for the review, and you're absolutely right. I will publish a V2
shortly.

Regards,
Phil

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

end of thread, other threads:[~2022-11-03 22:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-02 23:36 [PATCH] staging: r8188eu: change return type of rtw_set_802_11_disassociate to void Phillip Potter
2022-11-03  5:37 ` Michael Straube
2022-11-03 22:53   ` Phillip Potter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).