Skip to content

Commit

Permalink
mtd: rawnand: gpmi: Fix runtime PM imbalance on error
Browse files Browse the repository at this point in the history
pm_runtime_get_sync() increments the runtime PM usage counter even
when it returns an error code. Thus a pairing decrement is needed on
the error handling path to keep the counter balanced.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20200522095139.19653-1-dinghao.liu@zju.edu.cn
  • Loading branch information
Dinghao Liu authored and Miquel Raynal committed May 31, 2020
1 parent 5d55714 commit 550e68e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
Original file line number Diff line number Diff line change
Expand Up @@ -540,8 +540,10 @@ static int bch_set_geometry(struct gpmi_nand_data *this)
return ret;

ret = pm_runtime_get_sync(this->dev);
if (ret < 0)
if (ret < 0) {
pm_runtime_put_autosuspend(this->dev);
return ret;
}

/*
* Due to erratum #2847 of the MX23, the BCH cannot be soft reset on this
Expand Down

0 comments on commit 550e68e

Please sign in to comment.