[PATCH v2] ASoC: ES8389: convert to devm_clk_get_optional() to get clock

Li Jian posted 1 patch 1 month, 2 weeks ago
There is a newer version of this series
sound/soc/codecs/es8389.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH v2] ASoC: ES8389: convert to devm_clk_get_optional() to get clock
Posted by Li Jian 1 month, 2 weeks ago
Per Documentation/devicetree/bindings/sound/everest,es8389.yaml,
this driver does not require `mclk', so the DT node may lack this
 property (even the example lacks the `mclk' property). Therefore,
 the driver code should handle this situation by using
 `devm_clk_get_optional()'.

Indeed there is already null checking based on CONFIG_HAVE_CLK,
 but the driver will not finish initialization, as previously
 devm_clk_get() would just return an error pointer. Address this
 by introducing a simple conversion to use `devm_clk_get_optional()'.

Cc: stable@vger.kernel.org
Fixes: commit 0319c26889f7 ("ASoC: codecs: add support for ES8389")
Signed-off-by: Li Jian <lazycat-xiao@foxmail.com>
---
 sound/soc/codecs/es8389.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/es8389.c b/sound/soc/codecs/es8389.c
index 8d418cae371a..449d9574b03a 100644
--- a/sound/soc/codecs/es8389.c
+++ b/sound/soc/codecs/es8389.c
@@ -892,7 +892,7 @@ static int es8389_probe(struct snd_soc_component *component)
 		return ret;
 	}
 
-	es8389->mclk = devm_clk_get(component->dev, "mclk");
+	es8389->mclk = devm_clk_get_optional(component->dev, "mclk");
 	if (IS_ERR(es8389->mclk))
 		return dev_err_probe(component->dev, PTR_ERR(es8389->mclk),
 			"ES8389 is unable to get mclk\n");
-- 
2.47.3