[alsa-devel] [PATCH] 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 --- Mark,
Would it be possible to get this patch into 3.16?
Thanks, Peter
sound/soc/codecs/tlv320aic31xx.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c index 539d1dd3c5e6..095f4556ab1b 100644 --- a/sound/soc/codecs/tlv320aic31xx.c +++ b/sound/soc/codecs/tlv320aic31xx.c @@ -1179,7 +1179,7 @@ static void aic31xx_pdata_from_of(struct aic31xx_priv *aic31xx) } #endif /* CONFIG_OF */
-static void aic31xx_device_init(struct aic31xx_priv *aic31xx) +static int aic31xx_device_init(struct aic31xx_priv *aic31xx) { int ret, i;
@@ -1198,7 +1198,7 @@ static void aic31xx_device_init(struct aic31xx_priv *aic31xx) "aic31xx-reset-pin"); if (ret < 0) { dev_err(aic31xx->dev, "not able to acquire gpio\n"); - return; + return ret; } }
@@ -1211,6 +1211,7 @@ static void aic31xx_device_init(struct aic31xx_priv *aic31xx) if (ret != 0) dev_err(aic31xx->dev, "Failed to request supplies: %d\n", ret);
+ return ret; }
static int aic31xx_i2c_probe(struct i2c_client *i2c, @@ -1240,7 +1241,9 @@ static int aic31xx_i2c_probe(struct i2c_client *i2c,
aic31xx->pdata.codec_type = id->driver_data;
- aic31xx_device_init(aic31xx); + ret = aic31xx_device_init(aic31xx); + if (ret) + return ret;
return snd_soc_register_codec(&i2c->dev, &soc_codec_driver_aic31xx, aic31xx_dai_driver,
On Fri, Jul 25, 2014 at 01:12:54PM +0300, Peter Ujfalusi wrote:
We need to return the error codes from aic31xx_device_init() and return from the i2c_probe with the error code.
Applied, thanks.
Would it be possible to get this patch into 3.16?
I've got rather too many patches queued up already that ought to have gone in but didn't get sent yet so it's questionable if anything can go in at this point, we've hopefully got at most one more spin before release. I've added a stable tag to it so if it doesn't make it then it'll appear in a point release.
participants (2)
-
Mark Brown
-
Peter Ujfalusi