Skip to contentSkip to conversation

spi: mxic: fix ps_clk leak in runtime resume

PATCH In review Felix Gu 2 participants 2 messages Sep 2 – Sep 18 SPI

lore
Share & tools
lore

Felix Gu

author
#0 lore raw

PATCH 1/1 spi: mxic: fix ps_clk leak in runtime resume

mxic_spi_runtime_resume() enables ps_clk before calling mxic_spi_clk_enable(). If the latter fails, ps_clk was not disabled.

Unwind ps_clk with clk_disable_unprepare() before returning the error.

Fixes b942d80b0a39 ("spi: Add MXIC controller driver")
---
 drivers/spi/spi-mxic.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/spi/spi-mxic.c +7 -1
index e3c85e5191e3..481edd4b35cb 100644
@@ -744,7 +744,13 @@ static int mxic_spi_runtime_resume(struct device *dev)
 		return ret;
 	}
 
-	return mxic_spi_clk_enable(mxic);
+	ret = mxic_spi_clk_enable(mxic);
+	if (ret) {
+		clk_disable_unprepare(mxic->ps_clk);
+		return ret;
+	}
+
+	return 0;
 }
 
 static const struct dev_pm_ops mxic_spi_dev_pm_ops = {

---
base-commit: 89c07d98716a13454ec3fd9f97689e812cc71bd4
change-id: 20260901-mxic-0c0a7fbca221

Best regards,

Signature · 1 line
Felix Gu <[email protected]>
maintainer
#1 lore raw
Quoted 1 line · Felix Gu

spi: mxic: fix ps_clk leak in runtime resume

Applied to

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

Thanks!

[1/1] spi: mxic: fix ps_clk leak in runtime resume

      https://git.kernel.org/broonie/spi/c/648e3c436032

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