]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android-sdk/kernel-video.git/commitdiff
ASoC: tlv320aic31xx: Do not ignore errors in aic31xx_device_init()
authorPeter Ujfalusi <peter.ujfalusi@ti.com>
Fri, 25 Jul 2014 10:12:54 +0000 (13:12 +0300)
committerJyri Sarha <jsarha@ti.com>
Fri, 19 Dec 2014 10:57:02 +0000 (12:57 +0200)
[ Upstream commit a72d2abbe5752f3a773c4d8b7b41ae41f617f772 ]

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
Conflicts:

sound/soc/codecs/tlv320aic31xx.c

Signed-off-by: Jyri Sarha <jsarha@ti.com>
sound/soc/codecs/tlv320aic31xx.c

index 0307909483cdff7ba4675b02a3ff2fbb7b94d712..d1e451faeaa5cae46b6aba56d8bb62c8bd473bc3 100644 (file)
@@ -1210,7 +1210,7 @@ static void aic31xx_pdata_from_of(struct aic31xx_priv *aic31xx)
 }
 #endif /* CONFIG_OF */
 
-void aic31xx_device_init(struct aic31xx_priv *aic31xx)
+static int aic31xx_device_init(struct aic31xx_priv *aic31xx)
 {
        int ret, i;
 
@@ -1229,7 +1229,7 @@ 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;
                }
        }
 
@@ -1242,6 +1242,7 @@ 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,
@@ -1272,7 +1273,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;
 
        ret = snd_soc_register_codec(&i2c->dev, &soc_codec_driver_aic31xx,
                                     aic31xx_dai_driver,