[PATCH] Staging: rtl8723bs: os_dep: Remove unneeded variable for return

Greg KH gregkh at linuxfoundation.org
Mon May 20 08:52:15 UTC 2019


On Sat, May 18, 2019 at 12:22:47PM +0530, Puranjay Mohan wrote:
> Remove unneeded variable "ret" and directly return 0 in functions.
> Fix following coccicheck warning:
> Unneeded variable: "ret". Return "0".
> 
> Signed-off-by: Puranjay Mohan <puranjay12 at gmail.com>
> ---
>  drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
> index db553f2e4c0b..b105ba698d55 100644
> --- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
> +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
> @@ -2441,20 +2441,18 @@ void rtw_cfg80211_indicate_sta_disassoc(struct adapter *padapter, unsigned char
>  
>  static int rtw_cfg80211_monitor_if_open(struct net_device *ndev)
>  {
> -	int ret = 0;
>  
>  	DBG_8192C("%s\n", __func__);
>  
> -	return ret;
> +	return 0;
>  }

As this function does nothing, it should just be removed.

>  
>  static int rtw_cfg80211_monitor_if_close(struct net_device *ndev)
>  {
> -	int ret = 0;
>  
>  	DBG_8192C("%s\n", __func__);
>  
> -	return ret;
> +	return 0;
>  }

Same here.

>  
>  static netdev_tx_t rtw_cfg80211_monitor_if_xmit_entry(struct sk_buff *skb, struct net_device *ndev)
> @@ -2606,11 +2604,10 @@ static netdev_tx_t rtw_cfg80211_monitor_if_xmit_entry(struct sk_buff *skb, struc
>  
>  static int rtw_cfg80211_monitor_if_set_mac_address(struct net_device *ndev, void *addr)
>  {
> -	int ret = 0;
>  
>  	DBG_8192C("%s\n", __func__);
>  
> -	return ret;
> +	return 0;
>  }

This should also be removed, as it does nothing, and it is faking out
the network core to say it really does support this option, but it does
not, which is not good at all.

thanks,

greg k-h


More information about the devel mailing list