Re: [PATCH] staging: r8188eu: os_dep: remove the goto statement
From: Saurav Girepunje
Date: Mon Nov 01 2021 - 00:28:17 EST
On 01/11/21 12:47 am, Joe Perches wrote:
> On Sun, 2021-10-31 at 21:43 +0300, Pavel Skripkin wrote:
>> On 10/31/21 21:10, Saurav Girepunje wrote:
>>> Remove the goto statement from rtw_init_drv_sw(). In this function goto
>>> can be replace by return statement. As on goto label exit, function
>>> only return it is not performing any cleanup. Avoiding goto will
>>> improve the function readability.
> []
>>> diff --git a/drivers/staging/r8188eu/os_dep/os_intfs.c b/drivers/staging/r8188eu/os_dep/os_intfs.c
> []
>>> @@ -480,48 +480,34 @@ u8 rtw_init_drv_sw(struct adapter *padapter)
>>> {
>>> u8 ret8 = _SUCCESS;
>>
>> Btw, this variable can be removed completely then. It's used only for:
>>
>> ret8 = rtw_init_default_value(padapter);
>>
>> with your patch applied, but rtw_init_default_value() always returns
>> _SUCCESS.
>>
>>> -exit:
>>> return ret8;
>>> }
>>
>> And just `return _SUCCESS;` here.
>
> And maybe one day s/_SUCCESS/true/ and s/_FAIL/false/
> with appropriate conversions to bool
>
>
Yes this is another improvement possible on this function.
Regards,
Saurav