[PATCH 4.19 321/346] spi: mt7621: fix missing clk_disable_unprepare() on error in mt7621_spi_probe

From: Greg Kroah-Hartman
Date: Mon Dec 28 2020 - 10:55:00 EST


From: Qinglang Miao <miaoqinglang@xxxxxxxxxx>

commit 702b15cb97123cedcec56a39d9a21c5288eb9ae1 upstream.

Fix the missing clk_disable_unprepare() before return
from mt7621_spi_probe in the error handling case.

Fixes: cbd66c626e16 ("spi: mt7621: Move SPI driver out of staging")
Signed-off-by: Qinglang Miao <miaoqinglang@xxxxxxxxxx>
Link: https://lore.kernel.org/r/20201103074912.195576-1-miaoqinglang@xxxxxxxxxx
Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
drivers/staging/mt7621-spi/spi-mt7621.c | 2 ++
1 file changed, 2 insertions(+)

--- a/drivers/staging/mt7621-spi/spi-mt7621.c
+++ b/drivers/staging/mt7621-spi/spi-mt7621.c
@@ -455,6 +455,7 @@ static int mt7621_spi_probe(struct platf
master = spi_alloc_master(&pdev->dev, sizeof(*rs));
if (master == NULL) {
dev_info(&pdev->dev, "master allocation failed\n");
+ clk_disable_unprepare(clk);
return -ENOMEM;
}

@@ -480,6 +481,7 @@ static int mt7621_spi_probe(struct platf
ret = device_reset(&pdev->dev);
if (ret) {
dev_err(&pdev->dev, "SPI reset failed!\n");
+ clk_disable_unprepare(clk);
return ret;
}