From: Nathan Chancellor <natechancellor@gmail.com>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>,
Ulf Hansson <ulf.hansson@linaro.org>,
Michal Simek <michal.simek@xilinx.com>,
Manish Narani <manish.narani@xilinx.com>,
linux-mmc@vger.kernel.org,
Linux ARM <linux-arm-kernel@lists.infradead.org>,
LKML <linux-kernel@vger.kernel.org>,
clang-built-linux <clang-built-linux@googlegroups.com>,
"kernelci . org bot" <bot@kernelci.org>
Subject: Re: [PATCH] mmc: sdhci-of-arasan: Remove uninitialized ret variables
Date: Thu, 16 Apr 2020 13:24:15 -0700 [thread overview]
Message-ID: <20200416202415.GA30964@ubuntu-s3-xlarge-x86> (raw)
In-Reply-To: <CAKwvOdkCMsDUGK88xGqfsA5Nc1eNmR+PbLBoHE0dv65aimcJyQ@mail.gmail.com>
On Thu, Apr 16, 2020 at 01:16:27PM -0700, Nick Desaulniers wrote:
> On Thu, Apr 16, 2020 at 11:24 AM Nathan Chancellor
> <natechancellor@gmail.com> wrote:
> >
> > Clang warns:
> >
> > drivers/mmc/host/sdhci-of-arasan.c:784:9: warning: variable 'ret' is
> > uninitialized when used here [-Wuninitialized]
> > return ret;
> > ^~~
> > drivers/mmc/host/sdhci-of-arasan.c:738:9: note: initialize the variable
> > 'ret' to silence this warning
> > int ret;
> > ^
> > = 0
> > drivers/mmc/host/sdhci-of-arasan.c:860:9: warning: variable 'ret' is
> > uninitialized when used here [-Wuninitialized]
> > return ret;
> > ^~~
> > drivers/mmc/host/sdhci-of-arasan.c:810:9: note: initialize the variable
> > 'ret' to silence this warning
> > int ret;
> > ^
> > = 0
> > 2 warnings generated.
> >
> > This looks like a copy paste error. Neither function has handling that
> > needs ret so just remove it and return 0 directly.
>
> Forgive me for not taking the time to look into this more carefully,
> but just a thought:
>
> Having functions always return a single integer literal as opposed to
> having a `void` return type in their function signature is a code
> smell. Did you consider the call sites of these functions to see if
> they do anything with the return value? I understand it may not be
> worthwhile/possible if these functions fulfil an interface that
> requires the int return type function signature. (It's also probably
Which is the case. These functions are passed to 'struct clk_ops', which
defines the set_phase member as
int (*set_phase)(struct clk_hw *hw, int degrees);
so we cannot just change the return to void since there are other
set_phase functions that do set a return value other than zero.
> faster for me to just look rather than type this all out, but I saw no
> mention of this consideration in the commit message or patch, so
> wanted to check that it had been performed).
Yeah, I should have probably mentioned that. I can do so if the
maintainers feel it worthwhile.
Cheers,
Nathan
next prev parent reply other threads:[~2020-04-16 20:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-16 18:24 [PATCH] mmc: sdhci-of-arasan: Remove uninitialized ret variables Nathan Chancellor
2020-04-16 20:16 ` Nick Desaulniers
2020-04-16 20:24 ` Nathan Chancellor [this message]
2020-04-16 21:57 ` Nick Desaulniers
2020-04-17 9:30 ` Ulf Hansson
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=20200416202415.GA30964@ubuntu-s3-xlarge-x86 \
--to=natechancellor@gmail.com \
--cc=adrian.hunter@intel.com \
--cc=bot@kernelci.org \
--cc=clang-built-linux@googlegroups.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=manish.narani@xilinx.com \
--cc=michal.simek@xilinx.com \
--cc=ndesaulniers@google.com \
--cc=ulf.hansson@linaro.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox