mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-03 17:40:04 +00:00
ASoC: soc-pcm: indicate error message at dpcm_fe/be_dai_startup()
Indicating error message when failed case is very useful for debuging. In many case, its style is like below. int function(...) { ... return ret; } int caller(...) { ... ret = function(...); if (ret < 0) dev_err(...) ... } This is not so bad, but in this style *each caller* needs to indicate duplicate same error message, and some caller is forgetting to do it. And caller can't indicate detail function() error information. If function() indicates error message, we can get same and detail information without forgot. int function(...) { ... if (ret < 0) dev_err(...) return ret; } int caller(...) { ... ret = function(...); ... } This patch follow above style at dpcm_fe/be_dai_startup(). Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87h7ldutay.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
81c82a9edb
commit
06aaeb8742
1 changed files with 12 additions and 6 deletions
|
@ -1475,15 +1475,16 @@ void dpcm_be_dai_stop(struct snd_soc_pcm_runtime *fe, int stream,
|
||||||
|
|
||||||
int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream)
|
int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream)
|
||||||
{
|
{
|
||||||
|
struct snd_soc_pcm_runtime *be;
|
||||||
struct snd_soc_dpcm *dpcm;
|
struct snd_soc_dpcm *dpcm;
|
||||||
int err, count = 0;
|
int err, count = 0;
|
||||||
|
|
||||||
/* only startup BE DAIs that are either sinks or sources to this FE DAI */
|
/* only startup BE DAIs that are either sinks or sources to this FE DAI */
|
||||||
for_each_dpcm_be(fe, stream, dpcm) {
|
for_each_dpcm_be(fe, stream, dpcm) {
|
||||||
|
struct snd_pcm_substream *be_substream;
|
||||||
|
|
||||||
struct snd_soc_pcm_runtime *be = dpcm->be;
|
be = dpcm->be;
|
||||||
struct snd_pcm_substream *be_substream =
|
be_substream = snd_soc_dpcm_get_substream(be, stream);
|
||||||
snd_soc_dpcm_get_substream(be, stream);
|
|
||||||
|
|
||||||
if (!be_substream) {
|
if (!be_substream) {
|
||||||
dev_err(be->dev, "ASoC: no backend %s stream\n",
|
dev_err(be->dev, "ASoC: no backend %s stream\n",
|
||||||
|
@ -1535,6 +1536,9 @@ int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream)
|
||||||
unwind:
|
unwind:
|
||||||
dpcm_be_dai_startup_rollback(fe, stream, dpcm);
|
dpcm_be_dai_startup_rollback(fe, stream, dpcm);
|
||||||
|
|
||||||
|
dev_err(fe->dev, "ASoC: %s() failed at %s (%d)\n",
|
||||||
|
__func__, be->dai_link->name, err);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1749,10 +1753,8 @@ static int dpcm_fe_dai_startup(struct snd_pcm_substream *fe_substream)
|
||||||
dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE);
|
dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE);
|
||||||
|
|
||||||
ret = dpcm_be_dai_startup(fe, stream);
|
ret = dpcm_be_dai_startup(fe, stream);
|
||||||
if (ret < 0) {
|
if (ret < 0)
|
||||||
dev_err(fe->dev,"ASoC: failed to start some BEs %d\n", ret);
|
|
||||||
goto be_err;
|
goto be_err;
|
||||||
}
|
|
||||||
|
|
||||||
dev_dbg(fe->dev, "ASoC: open FE %s\n", fe->dai_link->name);
|
dev_dbg(fe->dev, "ASoC: open FE %s\n", fe->dai_link->name);
|
||||||
|
|
||||||
|
@ -1776,6 +1778,10 @@ static int dpcm_fe_dai_startup(struct snd_pcm_substream *fe_substream)
|
||||||
dpcm_be_dai_startup_unwind(fe, stream);
|
dpcm_be_dai_startup_unwind(fe, stream);
|
||||||
be_err:
|
be_err:
|
||||||
dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
|
dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
|
||||||
|
|
||||||
|
if (ret < 0)
|
||||||
|
dev_err(fe->dev, "%s() failed (%d)\n", __func__, ret);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue