Blob Blame History Raw
From cc4d8cebbf2a1239aab71a8077fbe20f24ec2165 Mon Sep 17 00:00:00 2001
From: Jerome Brunet <jbrunet@baylibre.com>
Date: Thu, 23 Jul 2020 16:20:20 +0200
Subject: [PATCH] ASoC: soc-component: don't report of_xlate_dai_name failures
Git-commit: cc4d8cebbf2a1239aab71a8077fbe20f24ec2165
Patch-mainline: v5.9-rc1
References: jsc#SLE-16518

With commit e2329eeba45f ("ASoC: soc-component: add soc_component_err()")
every error different for ENOTSUPP or EPROBE_DEFER will log an error.

However, as explained in snd_soc_get_dai_name(), this callback may error
to indicate that the DAI is not matched by the component tested. If the
device provides other components, those may still match. Logging an error
in this case is misleading.

Don't use soc_component_ret() in snd_soc_component_of_xlate_dai_name()
to avoid spamming the log.

Fixes: e2329eeba45f ("ASoC: soc-component: add soc_component_err()")
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20200723142020.1338740-1-jbrunet@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Acked-by: Takashi Iwai <tiwai@suse.de>

---
 sound/soc/soc-component.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index c1b799f98460..dcc89fa8913a 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -344,13 +344,15 @@ int snd_soc_component_of_xlate_dai_name(struct snd_soc_component *component,
 					struct of_phandle_args *args,
 					const char **dai_name)
 {
-	int ret = -ENOTSUPP;
-
 	if (component->driver->of_xlate_dai_name)
-		ret = component->driver->of_xlate_dai_name(component,
-							   args, dai_name);
-
-	return soc_component_ret(component, ret);
+		return component->driver->of_xlate_dai_name(component,
+							    args, dai_name);
+	/*
+	 * Don't use soc_component_ret here because we may not want to report
+	 * the error just yet. If a device has more than one component, the
+	 * first may not match and we don't want spam the log with this.
+	 */
+	return -ENOTSUPP;
 }
 
 void snd_soc_component_setup_regmap(struct snd_soc_component *component)
-- 
2.16.4