]> git.baikalelectronics.ru Git - kernel.git/commit
mtd: rawnand: gpmi: fix reference count leak in gpmi ops
authorZhang Qilong <zhangqilong3@huawei.com>
Sat, 7 Nov 2020 11:05:52 +0000 (19:05 +0800)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Thu, 10 Dec 2020 21:37:32 +0000 (22:37 +0100)
commit7d1eca9eb945e93a5797277cf5933e98bd9504c9
treea69efda2fb2b046eefafe355f46e01dfbe526b6c
parentb0c428cd727ac07af3454e137d941258edb79d39
mtd: rawnand: gpmi: fix reference count leak in gpmi ops

pm_runtime_get_sync() will increment pm usage at first and it
will resume the device later. If runtime of the device has
error or device is in inaccessible state(or other error state),
resume operation will fail. If we do not call put operation to
decrease the reference, it will result in reference leak in
the two functions(gpmi_init and gpmi_nfc_exec_op). Moreover,
this device cannot enter the idle state and always stay busy or
other non-idle state later. So we fixed it through adding
pm_runtime_put_noidle.

Fixes: 5647f280c2340 ("mtd: rawnand: gpmi: Fix suspend/resume problem")
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
Acked-by: Han Xu <han.xu@nxp.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20201107110552.1568742-1-zhangqilong3@huawei.com
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c