Re: [PATCH 5.4 007/320] mtd: rawnand: gpmi: Add ERR007117 protection for nfc_apply_timings

Pavel Machek
2022-01-24T20:54:15Z

[-- Attachment #1: Type: text/plain, Size: 1601 bytes --]

Hi!

> commit f53d4c109a666bf1a4883b45d546fba079258717 upstream.
>
> gpmi_io clock needs to be gated off when changing the parent/dividers of
> enfc_clk_root (i.MX6Q/i.MX6UL) respectively qspi2_clk_root (i.MX6SX).
> Otherwise this rate change can lead to an unresponsive GPMI core which
> results in DMA timeouts and failed driver probe:
...

> @@ -2429,7 +2449,9 @@ static int gpmi_nfc_exec_op(struct nand_
> */
> if (this->hw.must_apply_timings) {
> this->hw.must_apply_timings = false;
> - gpmi_nfc_apply_timings(this);
> + ret = gpmi_nfc_apply_timings(this);
> + if (ret)
> + return ret;
> }
>
> dev_dbg(this->dev, "%s: %d instructions\n", __func__, op->ninstrs);
>

AFAICT this leaks pm reference in the error case. Not sure what
variant is right, there, so...

Best regards,
Pavel

diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
index 1b64c5a5140d..06840cff6945 100644
--- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
+++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
@@ -2284,8 +2284,10 @@ static int gpmi_nfc_exec_op(struct nand_chip *chip,
if (this->hw.must_apply_timings) {
this->hw.must_apply_timings = false;
ret = gpmi_nfc_apply_timings(this);
- if (ret)
+ if (ret) {
+ pm_runtime_put_....(this->dev);
return ret;
+ }
}

dev_dbg(this->dev, "%s: %d instructions\n", __func__, op->ninstrs);

--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]