Re: [PATCH] ASoC: tlv320aic3x - fix variable may be useduninitialized warning

From: Mark Brown
Date: Wed Nov 24 2010 - 09:44:42 EST


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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/