Remove NULL check. NULL check before freeing function is not needed.
Signed-off-by: Saurav Girepunje <[email protected]>
---
drivers/staging/r8188eu/core/rtw_sta_mgt.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/staging/r8188eu/core/rtw_sta_mgt.c b/drivers/staging/r8188eu/core/rtw_sta_mgt.c
index f6dffed53a60..4726771a8403 100644
--- a/drivers/staging/r8188eu/core/rtw_sta_mgt.c
+++ b/drivers/staging/r8188eu/core/rtw_sta_mgt.c
@@ -155,9 +155,7 @@ u32 _rtw_free_sta_priv(struct sta_priv *pstapriv)
spin_unlock_bh(&pstapriv->sta_hash_lock);
/*===============================*/
- if (pstapriv->pallocated_stainfo_buf)
- vfree(pstapriv->pallocated_stainfo_buf);
- }
+ vfree(pstapriv->pallocated_stainfo_buf);
return _SUCCESS;
}
--
2.32.0
On 8/28/21 19:54, Saurav Girepunje wrote:
> Remove NULL check. NULL check before freeing function is not needed.
>
> Signed-off-by: Saurav Girepunje <[email protected]>
> ---
> drivers/staging/r8188eu/core/rtw_sta_mgt.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/staging/r8188eu/core/rtw_sta_mgt.c b/drivers/staging/r8188eu/core/rtw_sta_mgt.c
> index f6dffed53a60..4726771a8403 100644
> --- a/drivers/staging/r8188eu/core/rtw_sta_mgt.c
> +++ b/drivers/staging/r8188eu/core/rtw_sta_mgt.c
> @@ -155,9 +155,7 @@ u32 _rtw_free_sta_priv(struct sta_priv *pstapriv)
> spin_unlock_bh(&pstapriv->sta_hash_lock);
> /*===============================*/
>
> - if (pstapriv->pallocated_stainfo_buf)
> - vfree(pstapriv->pallocated_stainfo_buf);
> - }
> + vfree(pstapriv->pallocated_stainfo_buf);
>
> return _SUCCESS;
> }
> --
> 2.32.0
>
Acked-by: Michael Straube <[email protected]>
Thanks,
Michael
Hi Saurav,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on staging/staging-testing]
url: https://github.com/0day-ci/linux/commits/Saurav-Girepunje/staging-r8188eu-core-remove-null-check-before-vfree/20210829-015616
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 4adb389e08c95fdf91995271932c59250ff0d561
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/9c7f84adad9db1009055b063408e70c89fc51170
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Saurav-Girepunje/staging-r8188eu-core-remove-null-check-before-vfree/20210829-015616
git checkout 9c7f84adad9db1009055b063408e70c89fc51170
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=sh SHELL=/bin/bash drivers/staging/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>
All error/warnings (new ones prefixed by >>):
drivers/staging/r8188eu/core/rtw_sta_mgt.c: In function '_rtw_free_sta_priv':
>> drivers/staging/r8188eu/core/rtw_sta_mgt.c:163:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
163 | struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
| ^~~~~~
>> drivers/staging/r8188eu/core/rtw_sta_mgt.c:506:1: error: expected declaration or statement at end of input
506 | }
| ^
drivers/staging/r8188eu/core/rtw_sta_mgt.c:507: error: control reaches end of non-void function [-Werror=return-type]
At top level:
drivers/staging/r8188eu/core/rtw_sta_mgt.c:469:4: warning: 'rtw_access_ctrl' defined but not used [-Wunused-function]
469 | u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr)
| ^~~~~~~~~~~~~~~
drivers/staging/r8188eu/core/rtw_sta_mgt.c:458:18: warning: 'rtw_get_bcmc_stainfo' defined but not used [-Wunused-function]
458 | struct sta_info *rtw_get_bcmc_stainfo(struct adapter *padapter)
| ^~~~~~~~~~~~~~~~~~~~
drivers/staging/r8188eu/core/rtw_sta_mgt.c:436:5: warning: 'rtw_init_bcmc_stainfo' defined but not used [-Wunused-function]
436 | u32 rtw_init_bcmc_stainfo(struct adapter *padapter)
| ^~~~~~~~~~~~~~~~~~~~~
drivers/staging/r8188eu/core/rtw_sta_mgt.c:367:6: warning: 'rtw_free_all_stainfo' defined but not used [-Wunused-function]
367 | void rtw_free_all_stainfo(struct adapter *padapter)
| ^~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for SND_ATMEL_SOC_PDC
Depends on SOUND && !UML && SND && SND_SOC && SND_ATMEL_SOC && HAS_DMA
Selected by
- SND_ATMEL_SOC_SSC && SOUND && !UML && SND && SND_SOC && SND_ATMEL_SOC
- SND_ATMEL_SOC_SSC_PDC && SOUND && !UML && SND && SND_SOC && SND_ATMEL_SOC && ATMEL_SSC
vim +506 drivers/staging/r8188eu/core/rtw_sta_mgt.c
15865124feed88 Phillip Potter 2021-07-28 504
15865124feed88 Phillip Potter 2021-07-28 505 return res;
15865124feed88 Phillip Potter 2021-07-28 @506 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]
On 8/28/21 21:20, Michael Straube wrote:
> On 8/28/21 19:54, Saurav Girepunje wrote:
>> Remove NULL check. NULL check before freeing function is not needed.
>>
>> Signed-off-by: Saurav Girepunje <[email protected]>
>> ---
>> drivers/staging/r8188eu/core/rtw_sta_mgt.c | 4 +---
>> 1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/drivers/staging/r8188eu/core/rtw_sta_mgt.c
>> b/drivers/staging/r8188eu/core/rtw_sta_mgt.c
>> index f6dffed53a60..4726771a8403 100644
>> --- a/drivers/staging/r8188eu/core/rtw_sta_mgt.c
>> +++ b/drivers/staging/r8188eu/core/rtw_sta_mgt.c
>> @@ -155,9 +155,7 @@ u32 _rtw_free_sta_priv(struct sta_priv
>> *pstapriv)
>> spin_unlock_bh(&pstapriv->sta_hash_lock);
>> /*===============================*/
>>
>> - if (pstapriv->pallocated_stainfo_buf)
>> - vfree(pstapriv->pallocated_stainfo_buf);
>> - }
>> + vfree(pstapriv->pallocated_stainfo_buf);
>>
>> return _SUCCESS;
>> }
>> --
>> 2.32.0
>>
>
> Acked-by: Michael Straube <[email protected]>
>
> Thanks,
> Michael
Whoops, I missed that you removed the } that belongs to the enclosing if
block. Probably because it is not properly indented in the original
code.
Best regards,
Michael
On Sat, Aug 28, 2021 at 09:30:14PM +0200, Michael Straube wrote:
> On 8/28/21 21:20, Michael Straube wrote:
> > On 8/28/21 19:54, Saurav Girepunje wrote:
> > > Remove NULL check. NULL check before freeing function is not needed.
> > >
> > > Signed-off-by: Saurav Girepunje <[email protected]>
> > > ---
> > > ? drivers/staging/r8188eu/core/rtw_sta_mgt.c | 4 +---
> > > ? 1 file changed, 1 insertion(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/staging/r8188eu/core/rtw_sta_mgt.c
> > > b/drivers/staging/r8188eu/core/rtw_sta_mgt.c
> > > index f6dffed53a60..4726771a8403 100644
> > > --- a/drivers/staging/r8188eu/core/rtw_sta_mgt.c
> > > +++ b/drivers/staging/r8188eu/core/rtw_sta_mgt.c
> > > @@ -155,9 +155,7 @@ u32??? _rtw_free_sta_priv(struct??? sta_priv
> > > *pstapriv)
> > > ????????? spin_unlock_bh(&pstapriv->sta_hash_lock);
> > > ????????? /*===============================*/
> > >
> > > -??????? if (pstapriv->pallocated_stainfo_buf)
> > > -??????????? vfree(pstapriv->pallocated_stainfo_buf);
> > > -??????? }
> > > +??????? vfree(pstapriv->pallocated_stainfo_buf);
> > >
> > > ????? return _SUCCESS;
> > > ? }
> > > --
> > > 2.32.0
> > >
> >
> > Acked-by: Michael Straube <[email protected]>
> >
> > Thanks,
> > Michael
>
> Whoops, I missed that you removed the } that belongs to the enclosing if
> block. Probably because it is not properly indented in the original
> code.
Easy to miss because that bracket is in wrong place in first place.
Michael can you now on even build test before sending. Thanks.
>
> Best regards,
> Michael
>
On 8/28/21 21:47, Kari Argillander wrote:
> On Sat, Aug 28, 2021 at 09:30:14PM +0200, Michael Straube wrote:
>> On 8/28/21 21:20, Michael Straube wrote:
>>> On 8/28/21 19:54, Saurav Girepunje wrote:
>>>> Remove NULL check. NULL check before freeing function is not needed.
>>>>
>>>> Signed-off-by: Saurav Girepunje <[email protected]>
>>>> ---
>>>> drivers/staging/r8188eu/core/rtw_sta_mgt.c | 4 +---
>>>> 1 file changed, 1 insertion(+), 3 deletions(-)
>>>>
>>>> diff --git a/drivers/staging/r8188eu/core/rtw_sta_mgt.c
>>>> b/drivers/staging/r8188eu/core/rtw_sta_mgt.c
>>>> index f6dffed53a60..4726771a8403 100644
>>>> --- a/drivers/staging/r8188eu/core/rtw_sta_mgt.c
>>>> +++ b/drivers/staging/r8188eu/core/rtw_sta_mgt.c
>>>> @@ -155,9 +155,7 @@ u32 _rtw_free_sta_priv(struct sta_priv
>>>> *pstapriv)
>>>> spin_unlock_bh(&pstapriv->sta_hash_lock);
>>>> /*===============================*/
>>>>
>>>> - if (pstapriv->pallocated_stainfo_buf)
>>>> - vfree(pstapriv->pallocated_stainfo_buf);
>>>> - }
>>>> + vfree(pstapriv->pallocated_stainfo_buf);
>>>>
>>>> return _SUCCESS;
>>>> }
>>>> --
>>>> 2.32.0
>>>>
>>>
>>> Acked-by: Michael Straube <[email protected]>
>>>
>>> Thanks,
>>> Michael
>>
>> Whoops, I missed that you removed the } that belongs to the enclosing if
>> block. Probably because it is not properly indented in the original
>> code.
>
> Easy to miss because that bracket is in wrong place in first place.
>
> Michael can you now on even build test before sending. Thanks.
>
Sure, I usually do. For this one I did not but obviously I should have..
;)