public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: xiaolei li <xiaolei.li@mediatek.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Boris Brezillon <boris.brezillon@free-electrons.com>,
	Richard Weinberger <richard@nod.at>,
	David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Marek Vasut <marek.vasut@gmail.com>,
	"Cyrille Pitchen" <cyrille.pitchen@wedev4u.fr>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	<linux-mtd@lists.infradead.org>,
	<linux-mediatek@lists.infradead.org>,
	<kernel-janitors@vger.kernel.org>
Subject: Re: [PATCH] mtd: nand: mtk: release lock on error path
Date: Tue, 4 Jul 2017 09:20:47 +0800	[thread overview]
Message-ID: <1499131247.21448.2.camel@mhfsdcap03> (raw)
In-Reply-To: <20170703104858.2226i5bmcvnhhy2x@mwanda>

On Mon, 2017-07-03 at 13:54 +0300, Dan Carpenter wrote:
> We only want to hold the lock on the success path, not this error path.
> 
> Fixes: 7ec4a37c5d71 ("mtd: nand: mediatek: add support for different MTK NAND FLASH Controller IP")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/mtd/nand/mtk_ecc.c b/drivers/mtd/nand/mtk_ecc.c
> index f38e2bb1953e..6c3a4aab0b48 100644
> --- a/drivers/mtd/nand/mtk_ecc.c
> +++ b/drivers/mtd/nand/mtk_ecc.c
> @@ -273,8 +273,10 @@ int mtk_ecc_enable(struct mtk_ecc *ecc, struct mtk_ecc_config *config)
>  	mtk_ecc_wait_idle(ecc, op);
>  
>  	ret = mtk_ecc_config(ecc, config);
> -	if (ret)
> +	if (ret) {
> +		mutex_unlock(&ecc->lock);
>  		return ret;
> +	}
>  
>  	if (config->mode != ECC_NFI_MODE || op != ECC_ENCODE) {
>  		init_completion(&ecc->done);

Reviewed-by: Xiaolei Li <xiaolei.li@mediatek.com>

Thanks a lot!
Xiaolei

      reply	other threads:[~2017-07-04  1:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-03 10:54 [PATCH] mtd: nand: mtk: release lock on error path Dan Carpenter
2017-07-04  1:20 ` xiaolei li [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=1499131247.21448.2.camel@mhfsdcap03 \
    --to=xiaolei.li@mediatek.com \
    --cc=boris.brezillon@free-electrons.com \
    --cc=computersforpeace@gmail.com \
    --cc=cyrille.pitchen@wedev4u.fr \
    --cc=dan.carpenter@oracle.com \
    --cc=dwmw2@infradead.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=matthias.bgg@gmail.com \
    --cc=richard@nod.at \
    /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