2022-04-14 01:25:54

by Jaehee Park

[permalink] [raw]
Subject: [PATCH 1/6] staging: r8188eu: remove unnecessary braces in single statement block

Remove braces for single statement block to minimize the number of
empty lines, without loss of readability. Issue found with checkpatch.
WARNING: braces {} are not necessary for single statement blocks

Signed-off-by: Jaehee Park <[email protected]>
---
drivers/staging/r8188eu/core/rtw_mlme.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_mlme.c b/drivers/staging/r8188eu/core/rtw_mlme.c
index 3e9882f89f76..d3f4d7cdfa08 100644
--- a/drivers/staging/r8188eu/core/rtw_mlme.c
+++ b/drivers/staging/r8188eu/core/rtw_mlme.c
@@ -112,9 +112,8 @@ void _rtw_free_mlme_priv(struct mlme_priv *pmlmepriv)

rtw_free_mlme_priv_ie_data(pmlmepriv);

- if (pmlmepriv) {
+ if (pmlmepriv)
vfree(pmlmepriv->free_bss_buf);
- }

}

--
2.25.1


2022-04-15 10:53:15

by Pavel Skripkin

[permalink] [raw]
Subject: Re: [PATCH 1/6] staging: r8188eu: remove unnecessary braces in single statement block

Hi Jaehee,

On 4/13/22 23:11, Jaehee Park wrote:
> Remove braces for single statement block to minimize the number of
> empty lines, without loss of readability. Issue found with checkpatch.
> WARNING: braces {} are not necessary for single statement blocks
>
> Signed-off-by: Jaehee Park <[email protected]>
> ---
> drivers/staging/r8188eu/core/rtw_mlme.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/staging/r8188eu/core/rtw_mlme.c b/drivers/staging/r8188eu/core/rtw_mlme.c
> index 3e9882f89f76..d3f4d7cdfa08 100644
> --- a/drivers/staging/r8188eu/core/rtw_mlme.c
> +++ b/drivers/staging/r8188eu/core/rtw_mlme.c
> @@ -112,9 +112,8 @@ void _rtw_free_mlme_priv(struct mlme_priv *pmlmepriv)
>
> rtw_free_mlme_priv_ie_data(pmlmepriv);
>
> - if (pmlmepriv) {
> + if (pmlmepriv)
> vfree(pmlmepriv->free_bss_buf);
> - }
>

If pmlmepriv is equal to NULL we would die in
rtw_free_mlme_priv_ie_data(), so this check is just redundant




With regards,
Pavel Skripkin

2022-04-16 00:25:25

by Jaehee Park

[permalink] [raw]
Subject: Re: [PATCH 1/6] staging: r8188eu: remove unnecessary braces in single statement block

On Thu, Apr 14, 2022 at 10:50:52PM +0300, Pavel Skripkin wrote:
> Hi Jaehee,
>
> On 4/14/22 22:41, Jaehee Park wrote:
> > > > @@ -112,9 +112,8 @@ void _rtw_free_mlme_priv(struct mlme_priv *pmlmepriv)
> > > > rtw_free_mlme_priv_ie_data(pmlmepriv);
> > > > - if (pmlmepriv) {
> > > > + if (pmlmepriv)
> > > > vfree(pmlmepriv->free_bss_buf);
> > > > - }
> > >
> > > If pmlmepriv is equal to NULL we would die in rtw_free_mlme_priv_ie_data(),
> > > so this check is just redundant
> > >
> >
> > Hi Pavel, thank you for your comment! If I'm removing this if statement,
> > should I include vfree(pmlmepriv->free_bss_buf) in
> > rtw_free_mlme_priv_ie_data?
> >
>
> Hm
>
> Simple grep shows, that this member is just unused
>
> 1 drivers/staging/r8188eu/core/rtw_mlme.c|64 col 13| pmlmepriv->free_bss_buf
> = pbuf;
> 2 drivers/staging/r8188eu/core/rtw_mlme.c|116 col 20|
> vfree(pmlmepriv->free_bss_buf);
> 3 drivers/staging/r8188eu/include/rtw_mlme.h|322 col 6| u8 *free_bss_buf;
>
> so looks like you can just remove free_bss_buf and all related lines.
>
> I hope I haven't overlooked something
>

Hi Pavel, Thank you for your review! I have sent a second version of the
patchset.
Thanks,
Jaehee
>
>
> With regards,
> Pavel Skripkin



2022-04-16 00:33:35

by Pavel Skripkin

[permalink] [raw]
Subject: Re: [PATCH 1/6] staging: r8188eu: remove unnecessary braces in single statement block

Hi Jaehee,

On 4/14/22 22:41, Jaehee Park wrote:
>> > @@ -112,9 +112,8 @@ void _rtw_free_mlme_priv(struct mlme_priv *pmlmepriv)
>> > rtw_free_mlme_priv_ie_data(pmlmepriv);
>> > - if (pmlmepriv) {
>> > + if (pmlmepriv)
>> > vfree(pmlmepriv->free_bss_buf);
>> > - }
>>
>> If pmlmepriv is equal to NULL we would die in rtw_free_mlme_priv_ie_data(),
>> so this check is just redundant
>>
>
> Hi Pavel, thank you for your comment! If I'm removing this if statement,
> should I include vfree(pmlmepriv->free_bss_buf) in
> rtw_free_mlme_priv_ie_data?
>

Hm

Simple grep shows, that this member is just unused

1 drivers/staging/r8188eu/core/rtw_mlme.c|64 col 13|
pmlmepriv->free_bss_buf = pbuf;
2 drivers/staging/r8188eu/core/rtw_mlme.c|116 col 20|
vfree(pmlmepriv->free_bss_buf);
3 drivers/staging/r8188eu/include/rtw_mlme.h|322 col 6| u8 *free_bss_buf;

so looks like you can just remove free_bss_buf and all related lines.

I hope I haven't overlooked something



With regards,
Pavel Skripkin


Attachments:
OpenPGP_signature (855.00 B)
OpenPGP digital signature

2022-04-16 00:34:44

by Jaehee Park

[permalink] [raw]
Subject: Re: [PATCH 1/6] staging: r8188eu: remove unnecessary braces in single statement block

On Wed, Apr 13, 2022 at 11:24:46PM +0300, Pavel Skripkin wrote:
> Hi Jaehee,
>
> On 4/13/22 23:11, Jaehee Park wrote:
> > Remove braces for single statement block to minimize the number of
> > empty lines, without loss of readability. Issue found with checkpatch.
> > WARNING: braces {} are not necessary for single statement blocks
> >
> > Signed-off-by: Jaehee Park <[email protected]>
> > ---
> > drivers/staging/r8188eu/core/rtw_mlme.c | 3 +--
> > 1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/drivers/staging/r8188eu/core/rtw_mlme.c b/drivers/staging/r8188eu/core/rtw_mlme.c
> > index 3e9882f89f76..d3f4d7cdfa08 100644
> > --- a/drivers/staging/r8188eu/core/rtw_mlme.c
> > +++ b/drivers/staging/r8188eu/core/rtw_mlme.c
> > @@ -112,9 +112,8 @@ void _rtw_free_mlme_priv(struct mlme_priv *pmlmepriv)
> > rtw_free_mlme_priv_ie_data(pmlmepriv);
> > - if (pmlmepriv) {
> > + if (pmlmepriv)
> > vfree(pmlmepriv->free_bss_buf);
> > - }
>
> If pmlmepriv is equal to NULL we would die in rtw_free_mlme_priv_ie_data(),
> so this check is just redundant
>

Hi Pavel, thank you for your comment! If I'm removing this if statement,
should I include vfree(pmlmepriv->free_bss_buf) in
rtw_free_mlme_priv_ie_data?

>
>
>
> With regards,
> Pavel Skripkin