Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: soc-core: tidyup soc_probe_aux_devices()

snd_soc_bind_card() is calling many initialize functions
for each card / link / dai / aux etc, etc, etc...
When error happen, the message is indicated at snd_soc_bind_card(),
not at each functions.
But, only soc_probe_aux_devices() case is indicating error at functions,
not at snd_soc_bind_card().
It is not an issue, but unbalanced.

This patch moves error message to snd_soc_bind_card().
Also avoids deep-nested code.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87lfsthkw9.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Kuninori Morimoto and committed by
Mark Brown
74bd3f92 ed90c013

+12 -12
+12 -12
sound/soc/soc-core.c
··· 1579 1579 1580 1580 static int soc_probe_aux_devices(struct snd_soc_card *card) 1581 1581 { 1582 - struct snd_soc_component *comp; 1582 + struct snd_soc_component *component; 1583 1583 int order; 1584 1584 int ret; 1585 1585 1586 1586 for_each_comp_order(order) { 1587 - for_each_card_auxs(card, comp) { 1588 - if (comp->driver->probe_order == order) { 1589 - ret = soc_probe_component(card, comp); 1590 - if (ret < 0) { 1591 - dev_err(card->dev, 1592 - "ASoC: failed to probe aux component %s %d\n", 1593 - comp->name, ret); 1594 - return ret; 1595 - } 1596 - } 1587 + for_each_card_auxs(card, component) { 1588 + if (component->driver->probe_order != order) 1589 + continue; 1590 + 1591 + ret = soc_probe_component(card, component); 1592 + if (ret < 0) 1593 + return ret; 1597 1594 } 1598 1595 } 1599 1596 ··· 2039 2042 2040 2043 /* probe auxiliary components */ 2041 2044 ret = soc_probe_aux_devices(card); 2042 - if (ret < 0) 2045 + if (ret < 0) { 2046 + dev_err(card->dev, 2047 + "ASoC: failed to probe aux component %d\n", ret); 2043 2048 goto probe_end; 2049 + } 2044 2050 2045 2051 /* probe all DAI links on this card */ 2046 2052 ret = soc_probe_link_dais(card);