aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@ti.com>2014-07-25 06:12:54 -0400
committerMark Brown <broonie@linaro.org>2014-07-25 14:00:05 -0400
commita72d2abbe5752f3a773c4d8b7b41ae41f617f772 (patch)
tree3eccc2468e314a6d084996be1fc12e2295945fa2
parent7171511eaec5bf23fb06078f59784a3a0626b38f (diff)
ASoC: tlv320aic31xx: Do not ignore errors in aic31xx_device_init()
We need to return the error codes from aic31xx_device_init() and return from the i2c_probe with the error code. We will have kernel panic (NULL pointer dereference) in regulator_register_notifier() in case the devm_regulator_bulk_get() fails (with -EPROBE_DEFER for example). Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org> Cc: stable@vger.kernel.org
-rw-r--r--sound/soc/codecs/tlv320aic31xx.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c
index 23419109ecac..1cdae8ccc61b 100644
--- a/sound/soc/codecs/tlv320aic31xx.c
+++ b/sound/soc/codecs/tlv320aic31xx.c
@@ -1178,7 +1178,7 @@ static void aic31xx_pdata_from_of(struct aic31xx_priv *aic31xx)
1178} 1178}
1179#endif /* CONFIG_OF */ 1179#endif /* CONFIG_OF */
1180 1180
1181static void aic31xx_device_init(struct aic31xx_priv *aic31xx) 1181static int aic31xx_device_init(struct aic31xx_priv *aic31xx)
1182{ 1182{
1183 int ret, i; 1183 int ret, i;
1184 1184
@@ -1197,7 +1197,7 @@ static void aic31xx_device_init(struct aic31xx_priv *aic31xx)
1197 "aic31xx-reset-pin"); 1197 "aic31xx-reset-pin");
1198 if (ret < 0) { 1198 if (ret < 0) {
1199 dev_err(aic31xx->dev, "not able to acquire gpio\n"); 1199 dev_err(aic31xx->dev, "not able to acquire gpio\n");
1200 return; 1200 return ret;
1201 } 1201 }
1202 } 1202 }
1203 1203
@@ -1210,6 +1210,7 @@ static void aic31xx_device_init(struct aic31xx_priv *aic31xx)
1210 if (ret != 0) 1210 if (ret != 0)
1211 dev_err(aic31xx->dev, "Failed to request supplies: %d\n", ret); 1211 dev_err(aic31xx->dev, "Failed to request supplies: %d\n", ret);
1212 1212
1213 return ret;
1213} 1214}
1214 1215
1215static int aic31xx_i2c_probe(struct i2c_client *i2c, 1216static int aic31xx_i2c_probe(struct i2c_client *i2c,
@@ -1239,7 +1240,9 @@ static int aic31xx_i2c_probe(struct i2c_client *i2c,
1239 1240
1240 aic31xx->pdata.codec_type = id->driver_data; 1241 aic31xx->pdata.codec_type = id->driver_data;
1241 1242
1242 aic31xx_device_init(aic31xx); 1243 ret = aic31xx_device_init(aic31xx);
1244 if (ret)
1245 return ret;
1243 1246
1244 return snd_soc_register_codec(&i2c->dev, &soc_codec_driver_aic31xx, 1247 return snd_soc_register_codec(&i2c->dev, &soc_codec_driver_aic31xx,
1245 aic31xx_dai_driver, 1248 aic31xx_dai_driver,