From: Lee Jones <lee.jones@linaro.org>
To: Charles Keepax <ckeepax@opensource.cirrus.com>
Cc: arnd@arndb.de, natechancellor@gmail.com, ottosabart@seberm.com,
linux-kernel@vger.kernel.org, patches@opensource.cirrus.com
Subject: Re: [PATCH 1/4 RESEND] mfd: arizona: fix undefined behavior
Date: Wed, 12 Jun 2019 09:31:38 +0100 [thread overview]
Message-ID: <20190612083138.GT4797@dell> (raw)
In-Reply-To: <20190520090628.29061-1-ckeepax@opensource.cirrus.com>
On Mon, 20 May 2019, Charles Keepax wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> When the driver is used with a subdevice that is disabled in the
> kernel configuration, clang gets a little confused about the
> control flow and fails to notice that n_subdevs is only
> uninitialized when subdevs is NULL, and we check for that,
> leading to a false-positive warning:
>
> drivers/mfd/arizona-core.c:1423:19: error: variable 'n_subdevs' is uninitialized when used here
> [-Werror,-Wuninitialized]
> subdevs, n_subdevs, NULL, 0, NULL);
> ^~~~~~~~~
> drivers/mfd/arizona-core.c:999:15: note: initialize the variable 'n_subdevs' to silence this warning
> int n_subdevs, ret, i;
> ^
> = 0
>
> Ideally, we would rearrange the code to avoid all those early
> initializations and have an explicit exit in each disabled case,
> but it's much easier to chicken out and add one more initialization
> here to shut up the warning.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
> Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
> ---
> drivers/mfd/arizona-core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied, thanks.
--
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
prev parent reply other threads:[~2019-06-12 8:31 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-20 9:06 [PATCH 1/4 RESEND] mfd: arizona: fix undefined behavior Charles Keepax
2019-05-20 9:06 ` [PATCH 2/4 RESEND] mfd: madera: Fix bad reference to pinctrl.txt file Charles Keepax
2019-05-27 13:52 ` Mauro Carvalho Chehab
2019-06-12 8:31 ` Lee Jones
2019-05-20 9:06 ` [PATCH 3/4] mfd: madera: Fix potential uninitialised use of variable Charles Keepax
2019-06-12 8:31 ` Lee Jones
2019-05-20 9:06 ` [PATCH 4/4] mfd: madera: Add supply mapping for MICVDD Charles Keepax
2019-06-12 8:32 ` Lee Jones
2019-06-12 8:31 ` Lee Jones [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=20190612083138.GT4797@dell \
--to=lee.jones@linaro.org \
--cc=arnd@arndb.de \
--cc=ckeepax@opensource.cirrus.com \
--cc=linux-kernel@vger.kernel.org \
--cc=natechancellor@gmail.com \
--cc=ottosabart@seberm.com \
--cc=patches@opensource.cirrus.com \
/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.