From: Arnd Bergmann <arnd@arndb.de> To: Mark Brown <broonie@kernel.org> Cc: linux-arm-kernel@lists.infradead.org, Arnd Bergmann <arnd@arndb.de>, Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>, Brian Austin <brian.austin@cirrus.com>, Paul Handrigan <Paul.Handrigan@cirrus.com>, Liam Girdwood <lgirdwood@gmail.com>, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] ASoC: cs35l32: avoid uninitialized variable access Date: Mon, 25 Jan 2016 18:07:32 +0100 [thread overview] Message-ID: <1453741678-1988125-1-git-send-email-arnd@arndb.de> (raw) 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, but by adding a check for IS_ENABLED(CONFIG_OF), we can let the compiler know as well, and also generate smaller object code. Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- sound/soc/codecs/cs35l32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/codecs/cs35l32.c b/sound/soc/codecs/cs35l32.c index 44c30fe3e315..52ffaa8eb02b 100644 --- a/sound/soc/codecs/cs35l32.c +++ b/sound/soc/codecs/cs35l32.c @@ -372,7 +372,7 @@ static int cs35l32_i2c_probe(struct i2c_client *i2c_client, dev_err(&i2c_client->dev, "could not allocate pdata\n"); return -ENOMEM; } - if (i2c_client->dev.of_node) { + if (IS_ENABLED(CONFIG_OF) && i2c_client->dev.of_node) { ret = cs35l32_handle_of_data(i2c_client, &cs35l32->pdata); if (ret != 0) -- 2.7.0
WARNING: multiple messages have this Message-ID (diff)
From: arnd@arndb.de (Arnd Bergmann) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/2] ASoC: cs35l32: avoid uninitialized variable access Date: Mon, 25 Jan 2016 18:07:32 +0100 [thread overview] Message-ID: <1453741678-1988125-1-git-send-email-arnd@arndb.de> (raw) 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, but by adding a check for IS_ENABLED(CONFIG_OF), we can let the compiler know as well, and also generate smaller object code. Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- sound/soc/codecs/cs35l32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/codecs/cs35l32.c b/sound/soc/codecs/cs35l32.c index 44c30fe3e315..52ffaa8eb02b 100644 --- a/sound/soc/codecs/cs35l32.c +++ b/sound/soc/codecs/cs35l32.c @@ -372,7 +372,7 @@ static int cs35l32_i2c_probe(struct i2c_client *i2c_client, dev_err(&i2c_client->dev, "could not allocate pdata\n"); return -ENOMEM; } - if (i2c_client->dev.of_node) { + if (IS_ENABLED(CONFIG_OF) && i2c_client->dev.of_node) { ret = cs35l32_handle_of_data(i2c_client, &cs35l32->pdata); if (ret != 0) -- 2.7.0
next reply other threads:[~2016-01-25 17:08 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2016-01-25 17:07 Arnd Bergmann [this message] 2016-01-25 17:07 ` [PATCH 1/2] ASoC: cs35l32: avoid uninitialized variable access Arnd Bergmann 2016-01-25 17:07 ` [PATCH 2/2] ASoC: s3c24xx: use const snd_soc_component_driver pointer Arnd Bergmann 2016-01-25 17:07 ` Arnd Bergmann 2016-01-25 17:07 ` Arnd Bergmann 2016-01-26 4:09 ` Krzysztof Kozlowski 2016-01-26 4:09 ` Krzysztof Kozlowski 2016-01-27 18:37 ` Applied "ASoC: s3c24xx: use const snd_soc_component_driver pointer" to the asoc tree Mark Brown 2016-01-25 17:24 ` [PATCH 1/2] ASoC: cs35l32: avoid uninitialized variable access Austin, Brian 2016-03-05 5:39 ` Mark Brown 2016-03-05 5:39 ` Mark Brown 2016-03-05 14:54 ` Russell King - ARM Linux 2016-03-05 14:54 ` Russell King - ARM Linux 2016-03-06 20:43 ` Arnd Bergmann 2016-03-06 20:43 ` Arnd Bergmann 2016-03-06 20:43 ` Arnd Bergmann
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=1453741678-1988125-1-git-send-email-arnd@arndb.de \ --to=arnd@arndb.de \ --cc=Paul.Handrigan@cirrus.com \ --cc=alsa-devel@alsa-project.org \ --cc=brian.austin@cirrus.com \ --cc=broonie@kernel.org \ --cc=kuninori.morimoto.gx@renesas.com \ --cc=lgirdwood@gmail.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.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: linkBe 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.