Skip to content

Commit abf594c

Browse files
morimotobroonie
authored andcommitted
ASoC: soc-core: tidyup ret handling for card->disable_route_checks
commit a22ae72 ("ASoC: soc-core: disable route checks for legacy devices") added card->disable_route_checks to disable route checks for legacy devices at soc_probe_component() and snd_soc_bind_card(). And commit 6974857 ("ASoC: topology: Do not ignore route checks when parsing graphs") tidyup soc-topology for same reason. In snd_soc_bind_card() case, if snd_soc_dapm_add_routes() (A) error, but has card->disable_route_checks case (B), it will indicate dev_info() only, and then, next function (C) will be called. Thus, "ret" will be over written, and it is handled as non-error. static int snd_soc_bind_card(...) { ... (A) ret = snd_soc_dapm_add_routes(...); if (ret < 0) { (B) if (card->disable_route_checks) { dev_info(...); } else { ... goto probe_end; } } (C) ret = snd_soc_dapm_add_routes(...); ... In soc_probe_component() case, if snd_soc_dapm_add_routes() (a) error, and has card->disable_route_checks case (b), it will indicate dev_info(). But there is no next function after that, this means ret is still indicating error, and will not be over written. So error handline (c) will be handled, and will return error (d) static int soc_probe_component(...) { ... (a) ret = snd_soc_dapm_add_routes(...); if (ret < 0) { (b) if (card->disable_route_checks) { dev_info(...); } else { ... goto err_probe; } } /* see for_each_card_components */ list_add(...); err_probe: (c) if (ret < 0) soc_remove_component(...); (d) return ret; } In soc_tplg_dapm_graph_elems_load() case, snd_soc_dapm_add_routes() is called in for loop (1). if it was error (2), and doesn't have card->disable_route_checks case flag (3), it will break from loop. If card has flag, it will indicate dev_info() and handled as non-error. But ret is still indicating error in this case. If this error happen in last of loop, if will return error (4). static int soc_tplg_dapm_graph_elems_load(...) { ... (1) for (i = 0; i < count; i++) { ... (2) ret = snd_soc_dapm_add_routes(...); if (ret) { (3) if (!dapm->card->disable_route_checks) { dev_err(...); break; } dev_info(...); } } (4) return ret; } This patch set "ret = 0" for each case. Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.dev> Cc: Cezary Rojewski <cezary.rojewski@intel.com> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://patch.msgid.link/87wmg5tzra.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 5ce3bee commit abf594c

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

sound/soc/soc-core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1646,6 +1646,7 @@ static int soc_probe_component(struct snd_soc_card *card,
16461646
component->driver->num_dapm_routes);
16471647
if (ret < 0) {
16481648
if (card->disable_route_checks) {
1649+
ret = 0;
16491650
dev_info(card->dev,
16501651
"%s: disable_route_checks set, ignoring errors on add_routes\n",
16511652
__func__);
@@ -2236,6 +2237,7 @@ static int snd_soc_bind_card(struct snd_soc_card *card)
22362237
card->num_dapm_routes);
22372238
if (ret < 0) {
22382239
if (card->disable_route_checks) {
2240+
ret = 0;
22392241
dev_info(card->dev,
22402242
"%s: disable_route_checks set, ignoring errors on add_routes\n",
22412243
__func__);

sound/soc/soc-topology.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,12 +1102,14 @@ static int soc_tplg_dapm_graph_elems_load(struct soc_tplg *tplg,
11021102

11031103
ret = snd_soc_dapm_add_routes(dapm, route, 1);
11041104
if (ret) {
1105-
if (!dapm->card->disable_route_checks) {
1105+
if (dapm->card->disable_route_checks) {
1106+
ret = 0;
1107+
dev_info(tplg->dev,
1108+
"ASoC: disable_route_checks set, ignoring dapm_add_routes errors\n");
1109+
} else {
11061110
dev_err(tplg->dev, "ASoC: dapm_add_routes failed: %d\n", ret);
11071111
break;
11081112
}
1109-
dev_info(tplg->dev,
1110-
"ASoC: disable_route_checks set, ignoring dapm_add_routes errors\n");
11111113
}
11121114
}
11131115

0 commit comments

Comments
 (0)