答复: [PATCH V2] staging: r8188eu: Directly return _SUCCESS instead of using local ret variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, Greg KH

Yes, I think sync rtl8723bs and r8188eu will be better as they have same problem.

commit 067756acdac8e0dd91edf4800e844fcb6e0cc72a
Author: Hariprasad Kelam <hariprasad.kelam@xxxxxxxxx>
Date:   Mon Jul 15 23:16:18 2019 +0530

    staging: rtl8723bs: core: Change return type of init_mlme_ext_priv

    As init_mlme_ext_priv function always returns SUCCESS , We can change
    return type from int to void.

    Fixes below issue identified by coccicheck
    drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:464:5-8: Unneeded
    variable: "res". Return "_SUCCESS" on line 492

________________________________________
发件人: Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx>
发送时间: 2022年3月28日 16:47:45
收件人: 白浩文
抄送: Larry.Finger@xxxxxxxxxxxx; phil@xxxxxxxxxxxxxxxx; straube.linux@xxxxxxxxx; martin@xxxxxxxxx; linux-staging@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx
主题: Re: [PATCH V2] staging: r8188eu: Directly return _SUCCESS instead of using local ret variable

On Mon, Mar 28, 2022 at 04:43:48PM +0800, Haowen Bai wrote:
> fixes coccinelle warning:
> ./drivers/staging/r8188eu/core/rtw_mlme_ext.c:357:5-8: Unneeded variable: "res".
>  Return "_SUCCESS" on line 380
>
> Signed-off-by: Haowen Bai <baihaowen@xxxxxxxxx>
> ---
> V1->V2: split into two patches.
>
>  drivers/staging/r8188eu/core/rtw_mlme_ext.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
> index 931e6f2..4b7b0ee 100644
> --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c
> +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
> @@ -354,7 +354,6 @@ static u8 init_channel_set(struct adapter *padapter, u8 ChannelPlan, struct rt_c
>
>  int  init_mlme_ext_priv(struct adapter *padapter)
>  {
> -     int     res = _SUCCESS;
>       struct registry_priv *pregistrypriv = &padapter->registrypriv;
>       struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
>       struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
> @@ -377,7 +376,7 @@ int       init_mlme_ext_priv(struct adapter *padapter)
>
>       pmlmeext->active_keep_alive_check = true;
>
> -     return res;
> +     return _SUCCESS;

If a function can only ever succeed, why return anything?  Please make
this a function return void.

thanks,

greg k-h




[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux