Skip to content

Commit

Permalink
mtd: rawnand: gpmi: don't leak PM reference in error path
Browse files Browse the repository at this point in the history
commit 9161f36 upstream.

If gpmi_nfc_apply_timings() fails, the PM runtime usage counter must be
dropped.

Reported-by: Pavel Machek <pavel@denx.de>
Fixes: f53d4c1 ("mtd: rawnand: gpmi: Add ERR007117 protection for nfc_apply_timings")
Signed-off-by: Christian Eggers <ceggers@arri.de>
Cc: stable@vger.kernel.org
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20220125081619.6286-1-ceggers@arri.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
ceggers-arri authored and gregkh committed Feb 23, 2022
1 parent 45948a4 commit 4a7ec50
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
Expand Up @@ -2293,7 +2293,7 @@ static int gpmi_nfc_exec_op(struct nand_chip *chip,
this->hw.must_apply_timings = false;
ret = gpmi_nfc_apply_timings(this);
if (ret)
return ret;
goto out_pm;
}

dev_dbg(this->dev, "%s: %d instructions\n", __func__, op->ninstrs);
Expand Down Expand Up @@ -2422,6 +2422,7 @@ static int gpmi_nfc_exec_op(struct nand_chip *chip,

this->bch = false;

out_pm:
pm_runtime_mark_last_busy(this->dev);
pm_runtime_put_autosuspend(this->dev);

Expand Down

0 comments on commit 4a7ec50

Please sign in to comment.