[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190612083138.GT4797@dell>
Date: Wed, 12 Jun 2019 09:31:38 +0100
From: Lee Jones <lee.jones@...aro.org>
To: Charles Keepax <ckeepax@...nsource.cirrus.com>
Cc: arnd@...db.de, natechancellor@...il.com, ottosabart@...erm.com,
linux-kernel@...r.kernel.org, patches@...nsource.cirrus.com
Subject: Re: [PATCH 1/4 RESEND] mfd: arizona: fix undefined behavior
On Mon, 20 May 2019, Charles Keepax wrote:
> From: Arnd Bergmann <arnd@...db.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@...db.de>
> Reviewed-by: Nathan Chancellor <natechancellor@...il.com>
> Signed-off-by: Charles Keepax <ckeepax@...nsource.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
Powered by blists - more mailing lists