diff options
author | Axel Lin <axel.lin@gmail.com> | 2010-11-24 09:40:59 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-11-25 16:15:35 -0500 |
commit | fe99b55994f08d321cc5f621c3634b1de4961d01 (patch) | |
tree | 541b0d0479e01344c6a2080fb09ebb6d12e4c66f /sound | |
parent | 8b6b30ab665d3bbb23180c39f6215e6f64516ed0 (diff) |
ASoC: tlv320aic3x - fix variable may be used uninitialized warning
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
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/codecs/tlv320aic3x.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c index fc687790188b..77b8f9ae29be 100644 --- a/sound/soc/codecs/tlv320aic3x.c +++ b/sound/soc/codecs/tlv320aic3x.c | |||
@@ -1176,7 +1176,7 @@ EXPORT_SYMBOL_GPL(aic3x_set_gpio); | |||
1176 | int aic3x_get_gpio(struct snd_soc_codec *codec, int gpio) | 1176 | int aic3x_get_gpio(struct snd_soc_codec *codec, int gpio) |
1177 | { | 1177 | { |
1178 | u8 reg = gpio ? AIC3X_GPIO2_REG : AIC3X_GPIO1_REG; | 1178 | u8 reg = gpio ? AIC3X_GPIO2_REG : AIC3X_GPIO1_REG; |
1179 | u8 val, bit = gpio ? 2: 1; | 1179 | u8 val = 0, bit = gpio ? 2 : 1; |
1180 | 1180 | ||
1181 | aic3x_read(codec, reg, &val); | 1181 | aic3x_read(codec, reg, &val); |
1182 | return (val >> bit) & 1; | 1182 | return (val >> bit) & 1; |
@@ -1204,7 +1204,7 @@ EXPORT_SYMBOL_GPL(aic3x_set_headset_detection); | |||
1204 | 1204 | ||
1205 | int aic3x_headset_detected(struct snd_soc_codec *codec) | 1205 | int aic3x_headset_detected(struct snd_soc_codec *codec) |
1206 | { | 1206 | { |
1207 | u8 val; | 1207 | u8 val = 0; |
1208 | aic3x_read(codec, AIC3X_HEADSET_DETECT_CTRL_B, &val); | 1208 | aic3x_read(codec, AIC3X_HEADSET_DETECT_CTRL_B, &val); |
1209 | return (val >> 4) & 1; | 1209 | return (val >> 4) & 1; |
1210 | } | 1210 | } |
@@ -1212,7 +1212,7 @@ EXPORT_SYMBOL_GPL(aic3x_headset_detected); | |||
1212 | 1212 | ||
1213 | int aic3x_button_pressed(struct snd_soc_codec *codec) | 1213 | int aic3x_button_pressed(struct snd_soc_codec *codec) |
1214 | { | 1214 | { |
1215 | u8 val; | 1215 | u8 val = 0; |
1216 | aic3x_read(codec, AIC3X_HEADSET_DETECT_CTRL_B, &val); | 1216 | aic3x_read(codec, AIC3X_HEADSET_DETECT_CTRL_B, &val); |
1217 | return (val >> 5) & 1; | 1217 | return (val >> 5) & 1; |
1218 | } | 1218 | } |