[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200522100520.22130-1-dinghao.liu@zju.edu.cn>
Date: Fri, 22 May 2020 18:05:17 +0800
From: Dinghao Liu <dinghao.liu@....edu.cn>
To: dinghao.liu@....edu.cn, kjlu@....edu
Cc: Tudor Ambarus <tudor.ambarus@...rochip.com>,
Miquel Raynal <miquel.raynal@...tlin.com>,
Richard Weinberger <richard@....at>,
Vignesh Raghavendra <vigneshr@...com>,
Philipp Zabel <p.zabel@...gutronix.de>,
Boris Brezillon <bbrezillon@...nel.org>,
Michael Walle <michael@...le.cc>,
Thomas Gleixner <tglx@...utronix.de>,
Thor Thayer <thor.thayer@...ux.intel.com>,
Stephen Boyd <swboyd@...omium.org>,
linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: [PATCH] mtd: spi-nor: Fix runtime PM imbalance in cqspi_probe
When devm_reset_control_get_optional_exclusive() returns
an error code, a pairing runtime PM usage counter
decrement is needed to keep the counter balanced.
Also, call pm_runtime_disable() when pm_runtime_get_sync()
and devm_reset_control_get_optional_exclusive() return an
error code.
Signed-off-by: Dinghao Liu <dinghao.liu@....edu.cn>
---
drivers/mtd/spi-nor/controllers/cadence-quadspi.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/mtd/spi-nor/controllers/cadence-quadspi.c b/drivers/mtd/spi-nor/controllers/cadence-quadspi.c
index 494dcab4aaaa..eabdf01e0d08 100644
--- a/drivers/mtd/spi-nor/controllers/cadence-quadspi.c
+++ b/drivers/mtd/spi-nor/controllers/cadence-quadspi.c
@@ -1377,6 +1377,7 @@ static int cqspi_probe(struct platform_device *pdev)
ret = pm_runtime_get_sync(dev);
if (ret < 0) {
pm_runtime_put_noidle(dev);
+ pm_runtime_disable(dev);
return ret;
}
@@ -1390,12 +1391,16 @@ static int cqspi_probe(struct platform_device *pdev)
rstc = devm_reset_control_get_optional_exclusive(dev, "qspi");
if (IS_ERR(rstc)) {
dev_err(dev, "Cannot get QSPI reset.\n");
+ pm_runtime_put_sync(dev);
+ pm_runtime_disable(dev);
return PTR_ERR(rstc);
}
rstc_ocp = devm_reset_control_get_optional_exclusive(dev, "qspi-ocp");
if (IS_ERR(rstc_ocp)) {
dev_err(dev, "Cannot get QSPI OCP reset.\n");
+ pm_runtime_put_sync(dev);
+ pm_runtime_disable(dev);
return PTR_ERR(rstc_ocp);
}
--
2.17.1
Powered by blists - more mailing lists