[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200615092443.1e76169d@xps13>
Date: Mon, 15 Jun 2020 09:24:43 +0200
From: Miquel Raynal <miquel.raynal@...tlin.com>
To: Aditya Pakki <pakki001@....edu>
Cc: kjlu@....edu, wu000273@....edu, Han Xu <han.xu@....com>,
Richard Weinberger <richard@....at>,
Vignesh Raghavendra <vigneshr@...com>,
linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mtd: rawnand: gpmi: fix reference count leak due to
pm_runtime_get_sync
Hi Aditya,
Aditya Pakki <pakki001@....edu> wrote on Sat, 13 Jun 2020 22:43:00
-0500:
> On calling pm_runtime_get_sync() the reference count of the device
> is incremented. In case of failure, decrement the
> reference count before returning the error.
>
> Signed-off-by: Aditya Pakki <pakki001@....edu>
Missing Fixes/Stable tags here I guess?
> ---
> drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> index 061a8ddda275..657c0be5c038 100644
> --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> @@ -149,8 +149,10 @@ static int gpmi_init(struct gpmi_nand_data *this)
> int ret;
>
> ret = pm_runtime_get_sync(this->dev);
> - if (ret < 0)
> + if (ret < 0) {
> + pm_runtime_put_autosuspend(this->dev);
> return ret;
> + }
>
> ret = gpmi_reset_block(r->gpmi_regs, false);
> if (ret)
> @@ -2264,8 +2266,10 @@ static int gpmi_nfc_exec_op(struct nand_chip *chip,
> this->transfers[i].direction = DMA_NONE;
>
> ret = pm_runtime_get_sync(this->dev);
> - if (ret < 0)
> + if (ret < 0) {
> + pm_runtime_put_autosuspend(this->dev);
> return ret;
> + }
>
> /*
> * This driver currently supports only one NAND chip. Plus, dies share
Thanks,
Miquèl
Powered by blists - more mailing lists