[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.10.1603141002230.26218@heelroid>
Date: Mon, 14 Mar 2016 10:03:00 -0500
From: Brian Austin <brian.austin@...rus.com>
To: Arnd Bergmann <arnd@...db.de>
CC: Mark Brown <broonie@...nel.org>,
Brian Austin <brian.austin@...rus.com>,
Paul Handrigan <Paul.Handrigan@...rus.com>,
Liam Girdwood <lgirdwood@...il.com>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>, Axel Lin <axel.lin@...ics.com>,
<alsa-devel@...a-project.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3] ASoC: cs35l32: avoid uninitialized variable access
On Mon, 14 Mar 2016, Arnd Bergmann wrote:
> gcc warns about the possibilty of accessing a property read from
> devicetree in cs35l32_i2c_probe() when it has not been initialized
> because CONFIG_OF is disabled:
>
> sound/soc/codecs/cs35l32.c: In function 'cs35l32_i2c_probe':
> sound/soc/codecs/cs35l32.c:278:2: warning: 'val' may be used uninitialized in this function [-Wmaybe-uninitialized]
>
> The code is actually correct because it checks the dev->of_node
> variable first and we know this is NULL here when CONFIG_OF
> is disabled, but Russell King noticed that it's broken when
> we probe the device using DT, and the properties are absent.
>
> The code already has some checking for incorrect values, and
> I keep that checking unchanged here, but add an additional
> check for an error returned by the property accessor functions
> that now gets handled the same way as incorrect data in the
> properties.
>
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---
> v3: Restore a line that was accidentally removed, as pointed
> out by Brian Austin.
> v2: fix bug in case of CONFIG_OF and missing properties
> v1: only address warning for the !CONFIG_OF case
>
> sound/soc/codecs/cs35l32.c | 17 +++++++++++++----
> 1 file changed, 13 insertions(+), 4 deletions(-)
Acked-by: Brian Austin <brian.austin@...rus.com>
Thanks
Powered by blists - more mailing lists