public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Aditya Pakki <pakki001@umn.edu>
Cc: kjlu@umn.edu, wu000273@umn.edu, Han Xu <han.xu@nxp.com>,
	Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mtd: rawnand: gpmi: fix reference count leak due to pm_runtime_get_sync
Date: Mon, 15 Jun 2020 09:24:43 +0200	[thread overview]
Message-ID: <20200615092443.1e76169d@xps13> (raw)
In-Reply-To: <20200614034300.130385-1-pakki001@umn.edu>

Hi Aditya,

Aditya Pakki <pakki001@umn.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@umn.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

      reply	other threads:[~2020-06-15  7:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-14  3:43 [PATCH] mtd: rawnand: gpmi: fix reference count leak due to pm_runtime_get_sync Aditya Pakki
2020-06-15  7:24 ` Miquel Raynal [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200615092443.1e76169d@xps13 \
    --to=miquel.raynal@bootlin.com \
    --cc=han.xu@nxp.com \
    --cc=kjlu@umn.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=pakki001@umn.edu \
    --cc=richard@nod.at \
    --cc=vigneshr@ti.com \
    --cc=wu000273@umn.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox