bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] ASoC: fsi: Add check for clk_enable
@ 2022-03-02  6:28 Jiasheng Jiang
  2022-03-07 20:39 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Jiasheng Jiang @ 2022-03-02  6:28 UTC (permalink / raw)
  To: kuninori.morimoto.gx
  Cc: broonie, lgirdwood, perex, tiwai, ast, daniel, andrii, kafai,
	songliubraving, yhs, john.fastabend, kpsingh, f.suligoi,
	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>
---
Changelog:

v1 -> v2

* Change 1. Seperate the error handler.

v2 -> v3

* Change 1. Revert disable_xck and disable_ick.
---
 sound/soc/sh/fsi.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index cdf3b7f69ba7..e9a1eb6bdf66 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -816,14 +816,27 @@ 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 disable_xck;
+		ret = clk_enable(clock->div);
+		if (ret)
+			goto disable_ick;
 
 		clock->count++;
 	}
 
 	return ret;
+
+disable_ick:
+	clk_disable(clock->ick);
+disable_xck:
+	clk_disable(clock->xck);
+err:
+	return ret;
 }
 
 static int fsi_clk_disable(struct device *dev,
-- 
2.25.1


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

* Re: [PATCH v3] ASoC: fsi: Add check for clk_enable
  2022-03-02  6:28 [PATCH v3] ASoC: fsi: Add check for clk_enable Jiasheng Jiang
@ 2022-03-07 20:39 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2022-03-07 20:39 UTC (permalink / raw)
  To: Jiasheng Jiang, kuninori.morimoto.gx
  Cc: ast, f.suligoi, songliubraving, kafai, lgirdwood, linux-kernel,
	kpsingh, yhs, netdev, andrii, tiwai, alsa-devel, john.fastabend,
	daniel, bpf, perex

On Wed, 2 Mar 2022 14:28:44 +0800, Jiasheng Jiang wrote:
> As the potential failure of the clk_enable(),
> it should be better to check it and return error
> if fails.
> 
> 

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: fsi: Add check for clk_enable
      commit: 405afed8a728f23cfaa02f75bbc8bdd6b7322123

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

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

end of thread, other threads:[~2022-03-07 20:39 UTC | newest]

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).