[PATCH] ASoC: ak4642: Return of_clk_add_provider to transfer the error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Return of_clk_add_provider() in order to transfer the error if it fails due
to insufficient memory allocation or failure to set clock defaults.

Fixes: 171a0138ab75 ("ASoC: ak4642: enable to use MCKO as fixed rate output pin on DT")
Signed-off-by: Ma Ke <make24@xxxxxxxxxxx>
---
 sound/soc/codecs/ak4642.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c
index fe035d2fc913..2f1b295bca98 100644
--- a/sound/soc/codecs/ak4642.c
+++ b/sound/soc/codecs/ak4642.c
@@ -609,6 +609,7 @@ static struct clk *ak4642_of_parse_mcko(struct device *dev)
 	const char *clk_name = np->name;
 	const char *parent_clk_name = NULL;
 	u32 rate;
+	int ret;
 
 	if (of_property_read_u32(np, "clock-frequency", &rate))
 		return NULL;
@@ -619,8 +620,11 @@ static struct clk *ak4642_of_parse_mcko(struct device *dev)
 	of_property_read_string(np, "clock-output-names", &clk_name);
 
 	clk = clk_register_fixed_rate(dev, clk_name, parent_clk_name, 0, rate);
-	if (!IS_ERR(clk))
-		of_clk_add_provider(np, of_clk_src_simple_get, clk);
+	if (!IS_ERR(clk)) {
+		ret = of_clk_add_provider(np, of_clk_src_simple_get, clk);
+		if (ret)
+			return ERR_PTR(ret);
+	}
 
 	return clk;
 }
-- 
2.25.1





[Index of Archives]     [Pulseaudio]     [Linux Audio Users]     [ALSA Devel]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux