2022-04-12 20:08:06

by Jaehee Park

[permalink] [raw]
Subject: [PATCH 2/2] staging: greybus: remove return in an empty void function

Issue found by checkpatch:
WARNING: void function return statements are not generally useful

Signed-off-by: Jaehee Park <[email protected]>
---
drivers/staging/greybus/audio_codec.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/staging/greybus/audio_codec.c b/drivers/staging/greybus/audio_codec.c
index 0f50d1e51e2c..3e3a16568def 100644
--- a/drivers/staging/greybus/audio_codec.c
+++ b/drivers/staging/greybus/audio_codec.c
@@ -1032,7 +1032,6 @@ static int gbcodec_probe(struct snd_soc_component *comp)
static void gbcodec_remove(struct snd_soc_component *comp)
{
/* Empty function for now */
- return;
}

static int gbcodec_write(struct snd_soc_component *comp, unsigned int reg,
--
2.25.1


2022-04-12 20:48:11

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH 2/2] staging: greybus: remove return in an empty void function

On Mon, Apr 11, 2022 at 09:50:22PM -0400, Jaehee Park wrote:
> Issue found by checkpatch:
> WARNING: void function return statements are not generally useful
>
> Signed-off-by: Jaehee Park <[email protected]>
> ---
> drivers/staging/greybus/audio_codec.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/staging/greybus/audio_codec.c b/drivers/staging/greybus/audio_codec.c
> index 0f50d1e51e2c..3e3a16568def 100644
> --- a/drivers/staging/greybus/audio_codec.c
> +++ b/drivers/staging/greybus/audio_codec.c
> @@ -1032,7 +1032,6 @@ static int gbcodec_probe(struct snd_soc_component *comp)
> static void gbcodec_remove(struct snd_soc_component *comp)
> {
> /* Empty function for now */
> - return;
> }

This function is called from snd_soc_component_remove(). You can safely
remove the whole function. We do not like empty stub functions.

regards,
dan carpenter

2022-04-12 23:42:30

by Julia Lawall

[permalink] [raw]
Subject: Re: [PATCH 2/2] staging: greybus: remove return in an empty void function



On Mon, 11 Apr 2022, Jaehee Park wrote:

> Issue found by checkpatch:
> WARNING: void function return statements are not generally useful

Even for a simple change, it wouldbe better to follow the model that the
subject line should concisely orient the reader (eg "remove unneeded
return") and the log message should give a more complete description.
Simply repeating what checkpatch tells you is rarely a good idea. It says
what the problem is in a general way, whereas you should be explaining the
reasoning behind your fix in a specific case. Here you could say that an
empty function with void return type does not need an explicit return, and
that the problem was detected with checkpatch.

julia

>
> Signed-off-by: Jaehee Park <[email protected]>
> ---
> drivers/staging/greybus/audio_codec.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/staging/greybus/audio_codec.c b/drivers/staging/greybus/audio_codec.c
> index 0f50d1e51e2c..3e3a16568def 100644
> --- a/drivers/staging/greybus/audio_codec.c
> +++ b/drivers/staging/greybus/audio_codec.c
> @@ -1032,7 +1032,6 @@ static int gbcodec_probe(struct snd_soc_component *comp)
> static void gbcodec_remove(struct snd_soc_component *comp)
> {
> /* Empty function for now */
> - return;
> }
>
> static int gbcodec_write(struct snd_soc_component *comp, unsigned int reg,
> --
> 2.25.1
>
>
>

2022-04-13 00:06:34

by Jaehee Park

[permalink] [raw]
Subject: Re: [PATCH 2/2] staging: greybus: remove return in an empty void function

On Tue, Apr 12, 2022 at 10:28:43AM +0300, Dan Carpenter wrote:
> On Mon, Apr 11, 2022 at 09:50:22PM -0400, Jaehee Park wrote:
> > Issue found by checkpatch:
> > WARNING: void function return statements are not generally useful
> >
> > Signed-off-by: Jaehee Park <[email protected]>
> > ---
> > drivers/staging/greybus/audio_codec.c | 1 -
> > 1 file changed, 1 deletion(-)
> >
> > diff --git a/drivers/staging/greybus/audio_codec.c b/drivers/staging/greybus/audio_codec.c
> > index 0f50d1e51e2c..3e3a16568def 100644
> > --- a/drivers/staging/greybus/audio_codec.c
> > +++ b/drivers/staging/greybus/audio_codec.c
> > @@ -1032,7 +1032,6 @@ static int gbcodec_probe(struct snd_soc_component *comp)
> > static void gbcodec_remove(struct snd_soc_component *comp)
> > {
> > /* Empty function for now */
> > - return;
> > }
>
> This function is called from snd_soc_component_remove(). You can safely
> remove the whole function. We do not like empty stub functions.

I'll make this into another patch. Thank you for your suggestion.

>
> regards,
> dan carpenter
>

2022-04-13 00:06:36

by Jaehee Park

[permalink] [raw]
Subject: Re: [PATCH 2/2] staging: greybus: remove return in an empty void function

On Tue, Apr 12, 2022 at 09:04:08AM +0200, Julia Lawall wrote:
>
>
> On Mon, 11 Apr 2022, Jaehee Park wrote:
>
> > Issue found by checkpatch:
> > WARNING: void function return statements are not generally useful
>
> Even for a simple change, it wouldbe better to follow the model that the
> subject line should concisely orient the reader (eg "remove unneeded
> return") and the log message should give a more complete description.
> Simply repeating what checkpatch tells you is rarely a good idea. It says
> what the problem is in a general way, whereas you should be explaining the
> reasoning behind your fix in a specific case. Here you could say that an
> empty function with void return type does not need an explicit return, and
> that the problem was detected with checkpatch.
>
> julia
>

Thank you for your edits. I've submitted version 2 of the patchset just
now.

> >
> > Signed-off-by: Jaehee Park <[email protected]>
> > ---
> > drivers/staging/greybus/audio_codec.c | 1 -
> > 1 file changed, 1 deletion(-)
> >
> > diff --git a/drivers/staging/greybus/audio_codec.c b/drivers/staging/greybus/audio_codec.c
> > index 0f50d1e51e2c..3e3a16568def 100644
> > --- a/drivers/staging/greybus/audio_codec.c
> > +++ b/drivers/staging/greybus/audio_codec.c
> > @@ -1032,7 +1032,6 @@ static int gbcodec_probe(struct snd_soc_component *comp)
> > static void gbcodec_remove(struct snd_soc_component *comp)
> > {
> > /* Empty function for now */
> > - return;
> > }
> >
> > static int gbcodec_write(struct snd_soc_component *comp, unsigned int reg,
> > --
> > 2.25.1
> >
> >
> >