Re: [PATCH 1/2] ASoC: cs35l32: avoid uninitialized variable access

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Jan 25, 2016, at 11:07 AM, Arnd Bergmann <arnd@xxxxxxxx<mailto:arnd@xxxxxxxx>> 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, 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@xxxxxxxx<mailto:arnd@xxxxxxxx>>
---
sound/soc/codecs/cs35l32.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Thanks,

Acked-by: Brian Austin <brian.austin@xxxxxxxxxx<mailto:brian.austin@xxxxxxxxxx>>

_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux