From: "Fabio M. De Francesco" <fmdefrancesco@gmail.com>
To: Julia Lawall <julia.lawall@inria.fr>
Cc: johan@kernel.org, Jaehee Park <jhpark1013@gmail.com>,
elder@kernel.org, gregkh@linuxfoundation.org,
greybus-dev@lists.linaro.org, linux-staging@lists.linux.dev,
linux-kernel@vger.kernel.org, outreachy@lists.linux.dev
Subject: Re: [PATCH v2 2/2] staging: greybus: remove unneeded return
Date: Wed, 13 Apr 2022 08:35:55 +0200 [thread overview]
Message-ID: <6300782.K2JlShyGXD@leap> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2204130815020.3470@hadrien>
On mercoledì 13 aprile 2022 08:16:20 CEST Julia Lawall wrote:
>
> On Tue, 12 Apr 2022, Fabio M. De Francesco wrote:
>
> > On martedì 12 aprile 2022 21:59:15 CEST Jaehee Park wrote:
> > > An empty function with void return type does not need an explicit
> > > return. Issue found by checkpatch.
> > >
> > > Signed-off-by: Jaehee Park <jhpark1013@gmail.com>
> > > ---
> > > 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
> > >
> > Hi Jaehee,
> >
> > If I recall it correctly, Dan Carpenter suggested to remove this empty
> > function.
> >
> > When developers remove lines of code from a function which becomes
empty
> > after the removals, they also remove the resulting empty function and
> > delete all the calls (if there are any left) at the same time.
>
> It's probably not relevant in this case,
No, it's relevant :)
I should have been more exhaustive :(
> but the function could be needed
> if it is a branch of an ifdef. Also if it is stored in a structure field
> and the user of the structure does not check for NULL.
Here we have one of special cases you've mentioned. The pointer to the
function is stored in a structure field _but_ we know that the user does
check for NULL.
Thanks,
Fabio
> julia
prev parent reply other threads:[~2022-04-13 6:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-12 19:59 [PATCH v2 0/2] staging: greybus: fix warnings reported by checkpatch Jaehee Park
2022-04-12 19:59 ` [PATCH v2 1/2] staging: greybus: correct typo in comment Jaehee Park
2022-04-12 20:38 ` Alex Elder
2022-04-12 19:59 ` [PATCH v2 2/2] staging: greybus: remove unneeded return Jaehee Park
2022-04-12 20:35 ` Alex Elder
2022-04-13 4:43 ` Jaehee Park
2022-04-12 20:35 ` Fabio M. De Francesco
2022-04-13 4:44 ` Jaehee Park
2022-04-13 6:16 ` Julia Lawall
2022-04-13 6:35 ` Fabio M. De Francesco [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6300782.K2JlShyGXD@leap \
--to=fmdefrancesco@gmail.com \
--cc=elder@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=greybus-dev@lists.linaro.org \
--cc=jhpark1013@gmail.com \
--cc=johan@kernel.org \
--cc=julia.lawall@inria.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=outreachy@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.