ASoC: dapm: fix some pointer error handling
authorLinus Walleij <linus.walleij@linaro.org>
Fri, 20 Jan 2017 13:07:52 +0000 (14:07 +0100)
committerMark Brown <broonie@kernel.org>
Fri, 20 Jan 2017 13:11:02 +0000 (13:11 +0000)
commit 66feeec9322132689d42723df2537d60f96f8e44
"RFC: ASoC: dapm: handle probe deferrals"
forgot a to update some two sites where the call
was used. The static codechecks quickly found them.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: 66feeec93221 ("RFC: ASoC: dapm: handle probe deferrals")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/soc-dapm.c

index b218cc7bd9945b89e4ae61106ba7cdb84dec09a0..dcef67a9bd4854a29c79ad8355343c5f16ae76a2 100644 (file)
@@ -3935,6 +3935,16 @@ int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm,
                        template.name);
 
                w = snd_soc_dapm_new_control_unlocked(dapm, &template);
+               if (IS_ERR(w)) {
+                       int ret = PTR_ERR(w);
+
+                       /* Do not nag about probe deferrals */
+                       if (ret != -EPROBE_DEFER)
+                               dev_err(dapm->dev,
+                               "ASoC: Failed to create %s widget (%d)\n",
+                               dai->driver->playback.stream_name, ret);
+                       return ret;
+               }
                if (!w) {
                        dev_err(dapm->dev, "ASoC: Failed to create %s widget\n",
                                dai->driver->playback.stream_name);
@@ -3954,6 +3964,16 @@ int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm,
                        template.name);
 
                w = snd_soc_dapm_new_control_unlocked(dapm, &template);
+               if (IS_ERR(w)) {
+                       int ret = PTR_ERR(w);
+
+                       /* Do not nag about probe deferrals */
+                       if (ret != -EPROBE_DEFER)
+                               dev_err(dapm->dev,
+                               "ASoC: Failed to create %s widget (%d)\n",
+                               dai->driver->playback.stream_name, ret);
+                       return ret;
+               }
                if (!w) {
                        dev_err(dapm->dev, "ASoC: Failed to create %s widget\n",
                                dai->driver->capture.stream_name);