Commit 9a1bb600 authored by Charles Keepax's avatar Charles Keepax Committed by Mark Brown

ASoC: dapm: Move error message to avoid some duplication

Move the error message into snd_soc_dapm_new_dai from
dapm_connect_dai_pair, since the two copies are almost identical and
are the only callers.
Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20200409181209.30130-2-ckeepax@opensource.cirrus.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 65f1d3d9
...@@ -4165,6 +4165,8 @@ snd_soc_dapm_new_dai(struct snd_soc_card *card, ...@@ -4165,6 +4165,8 @@ snd_soc_dapm_new_dai(struct snd_soc_card *card,
w = snd_soc_dapm_new_control_unlocked(&card->dapm, &template); w = snd_soc_dapm_new_control_unlocked(&card->dapm, &template);
if (IS_ERR(w)) { if (IS_ERR(w)) {
ret = PTR_ERR(w); ret = PTR_ERR(w);
dev_err(rtd->dev, "ASoC: Failed to create %s widget: %d\n",
link_name, ret);
goto outfree_kcontrol_news; goto outfree_kcontrol_news;
} }
...@@ -4327,13 +4329,8 @@ static void dapm_connect_dai_pair(struct snd_soc_card *card, ...@@ -4327,13 +4329,8 @@ static void dapm_connect_dai_pair(struct snd_soc_card *card,
if (dai_link->params && !dai_link->playback_widget) { if (dai_link->params && !dai_link->playback_widget) {
substream = streams[SNDRV_PCM_STREAM_PLAYBACK].substream; substream = streams[SNDRV_PCM_STREAM_PLAYBACK].substream;
dai = snd_soc_dapm_new_dai(card, substream, "playback"); dai = snd_soc_dapm_new_dai(card, substream, "playback");
if (IS_ERR(dai)) { if (IS_ERR(dai))
dev_err(rtd->dev,
"ASoC: Failed to create DAI %s: %ld\n",
codec_dai->name,
PTR_ERR(dai));
goto capture; goto capture;
}
dai_link->playback_widget = dai; dai_link->playback_widget = dai;
} }
...@@ -4350,13 +4347,8 @@ static void dapm_connect_dai_pair(struct snd_soc_card *card, ...@@ -4350,13 +4347,8 @@ static void dapm_connect_dai_pair(struct snd_soc_card *card,
if (dai_link->params && !dai_link->capture_widget) { if (dai_link->params && !dai_link->capture_widget) {
substream = streams[SNDRV_PCM_STREAM_CAPTURE].substream; substream = streams[SNDRV_PCM_STREAM_CAPTURE].substream;
dai = snd_soc_dapm_new_dai(card, substream, "capture"); dai = snd_soc_dapm_new_dai(card, substream, "capture");
if (IS_ERR(dai)) { if (IS_ERR(dai))
dev_err(rtd->dev,
"ASoC: Failed to create DAI %s: %ld\n",
codec_dai->name,
PTR_ERR(dai));
return; return;
}
dai_link->capture_widget = dai; dai_link->capture_widget = dai;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment