[alsa-devel] [PATCH] ASoC: tlv320aic3x - fix variable may be used uninitialized warning

Mark Brown broonie at opensource.wolfsonmicro.com
Wed Nov 24 15:44:35 CET 2010


On Wed, Nov 24, 2010 at 10:40:59PM +0800, Axel Lin wrote:
> If aic3x_read failed , val is used uninitialized.
> Fix it by initializing val to 0.
> 
> This patch fixes below compile warning:
> sound/soc/codecs/tlv320aic3x.c: In function 'aic3x_get_gpio':
> sound/soc/codecs/tlv320aic3x.c:1183: warning: 'val' may be used uninitialized in this function
> sound/soc/codecs/tlv320aic3x.c: In function 'aic3x_headset_detected':
> sound/soc/codecs/tlv320aic3x.c:1211: warning: 'val' may be used uninitialized in this function
> sound/soc/codecs/tlv320aic3x.c: In function 'aic3x_button_pressed':
> sound/soc/codecs/tlv320aic3x.c:1219: warning: 'val' may be used uninitialized in this function

This does rather look like a compiler bug.  I'm generally against this
sort of change as it just tramples over the warning in cases where it
may be valid, though given the trivially small functions here it's hard
to care.

Really this stuff should all be written to use the standard jack and
GPIO APIs anyway.


More information about the Alsa-devel mailing list