mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ASoC: fsi: Add check for clk_enable
@ 2022-03-01  7:39 Jiasheng Jiang
  2022-03-01 12:44 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Jiasheng Jiang @ 2022-03-01  7:39 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, ast, daniel, andrii, kafai,
	songliubraving, yhs, john.fastabend, kpsingh, f.suligoi,
	kuninori.morimoto.gx
  Cc: alsa-devel, linux-kernel, netdev, bpf, Jiasheng Jiang

As the potential failure of the clk_enable(),
it should be better to check it and return error
if fails.

Fixes: ab6f6d85210c ("ASoC: fsi: add master clock control functions")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
 sound/soc/sh/fsi.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index cdf3b7f69ba7..93cfa77b8b54 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -816,14 +816,26 @@ static int fsi_clk_enable(struct device *dev,
 			return ret;
 		}
 
-		clk_enable(clock->xck);
-		clk_enable(clock->ick);
-		clk_enable(clock->div);
+		ret = clk_enable(clock->xck);
+		if (ret)
+			goto err;
+		ret = clk_enable(clock->ick);
+		if (ret)
+			goto err;
+		ret = clk_enable(clock->div);
+		if (ret)
+			goto err;
 
 		clock->count++;
 	}
 
 	return ret;
+
+err:
+	clk_disable(clock->xck);
+	clk_disable(clock->ick);
+	clk_disable(clock->div);
+	return ret;
 }
 
 static int fsi_clk_disable(struct device *dev,
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-03-01 12:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-01  7:39 [PATCH] ASoC: fsi: Add check for clk_enable Jiasheng Jiang
2022-03-01 12:44 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®