[PATCH] spi: slave-mt27xx: Call clk_disable_unprepare() only once in mtk_spi_slave_probe()

Markus Elfring posted 1 patch 2 months ago
drivers/spi/spi-slave-mt27xx.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
[PATCH] spi: slave-mt27xx: Call clk_disable_unprepare() only once in mtk_spi_slave_probe()
Posted by Markus Elfring 2 months ago
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 24 Sep 2024 20:47:29 +0200

A clk_disable_unprepare(mdata->spi_clk) call was immediately used
after a return value check for a devm_spi_register_controller() call
in this function implementation.
Thus call such a function only once instead directly before the check.

This issue was transformed by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/spi/spi-slave-mt27xx.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/spi/spi-slave-mt27xx.c b/drivers/spi/spi-slave-mt27xx.c
index 4a91b7bae3c6..40e1e7de0742 100644
--- a/drivers/spi/spi-slave-mt27xx.c
+++ b/drivers/spi/spi-slave-mt27xx.c
@@ -455,15 +455,13 @@ static int mtk_spi_slave_probe(struct platform_device *pdev)
 	pm_runtime_enable(&pdev->dev);

 	ret = devm_spi_register_controller(&pdev->dev, ctlr);
+	clk_disable_unprepare(mdata->spi_clk);
 	if (ret) {
 		dev_err(&pdev->dev,
 			"failed to register slave controller(%d)\n", ret);
-		clk_disable_unprepare(mdata->spi_clk);
 		goto err_disable_runtime_pm;
 	}

-	clk_disable_unprepare(mdata->spi_clk);
-
 	return 0;

 err_disable_runtime_pm:
--
2.46.1
Re: [PATCH] spi: slave-mt27xx: Call clk_disable_unprepare() only once in mtk_spi_slave_probe()
Posted by Mark Brown 1 month, 4 weeks ago
On Tue, 24 Sep 2024 20:56:08 +0200, Markus Elfring wrote:
> A clk_disable_unprepare(mdata->spi_clk) call was immediately used
> after a return value check for a devm_spi_register_controller() call
> in this function implementation.
> Thus call such a function only once instead directly before the check.
> 
> This issue was transformed by using the Coccinelle software.
> 
> [...]

Applied to

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

Thanks!

[1/1] spi: slave-mt27xx: Call clk_disable_unprepare() only once in mtk_spi_slave_probe()
      commit: 610442f85c12ff662e3dec50c53d92f7a8e5a783

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