[PATCH] staging: rtl8723bs: os_dep: os_intfs: fix warning Unneeded variable: "status". Return "_SUCCESS"

Greg Kroah-Hartman gregkh at linuxfoundation.org
Mon May 20 08:54:31 UTC 2019


On Sun, May 19, 2019 at 10:27:58PM +0530, Hariprasad Kelam wrote:
> This patch fixes below warnings reported by coccicheck
> 
> drivers/staging/rtl8723bs/os_dep/os_intfs.c:228:6-12: Unneeded variable:
> "status". Return "_SUCCESS" on line 333
> drivers/staging/rtl8723bs/os_dep/os_intfs.c:607:4-7: Unneeded variable:
> "ret". Return "_SUCCESS" on line 669
> drivers/staging/rtl8723bs/os_dep/os_intfs.c:713:4-8: Unneeded variable:
> "ret8". Return "_SUCCESS" on line 743
> drivers/staging/rtl8723bs/os_dep/os_intfs.c:1379:5-8: Unneeded variable:
> "ret". Return "_SUCCESS" on line 1421
> drivers/staging/rtl8723bs/os_dep/os_intfs.c:1429:5-8: Unneeded variable:
> "ret". Return "_SUCCESS" on line 1451
> drivers/staging/rtl8723bs/os_dep/os_intfs.c:1300:5-8: Unneeded variable:
> "ret". Return "_SUCCESS" on line 1368
> 
> Signed-off-by: Hariprasad Kelam <hariprasad.kelam at gmail.com>
> ---
>  drivers/staging/rtl8723bs/os_dep/os_intfs.c | 18 ++++++------------
>  1 file changed, 6 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
> index 8a9d838..71dfac5 100644
> --- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c
> +++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
> @@ -225,7 +225,6 @@ static int netdev_close (struct net_device *pnetdev);
>  
>  static uint loadparam(struct adapter *padapter, _nic_hdl pnetdev)
>  {
> -	uint status = _SUCCESS;
>  	struct registry_priv  *registry_par = &padapter->registrypriv;
>  
>  	registry_par->chip_version = (u8)rtw_chip_version;
> @@ -330,7 +329,7 @@ static uint loadparam(struct adapter *padapter, _nic_hdl pnetdev)
>  	registry_par->qos_opt_enable = (u8)rtw_qos_opt_enable;
>  
>  	registry_par->hiq_filter = (u8)rtw_hiq_filter;
> -	return status;
> +	return _SUCCESS;
>  }

If this, or any of these other functions, can only return "success",
then why return anything at all?  These should be fixed up to either
properly return an error if one can happen, or be a void function and
fix up the caller function as well.

thanks,

greg k-h


More information about the devel mailing list