linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Brian Norris <computersforpeace@gmail.com>
Cc: <linux-mtd@lists.infradead.org>
Subject: Re: [PATCH] mtd: nand: docg4: simplify error case
Date: Fri, 18 Dec 2015 21:24:30 +0100	[thread overview]
Message-ID: <20151218212430.35579c90@bbrezillon> (raw)
In-Reply-To: <1450467593-90957-1-git-send-email-computersforpeace@gmail.com>

On Fri, 18 Dec 2015 11:39:53 -0800
Brian Norris <computersforpeace@gmail.com> wrote:

> Other refactorings have left the 'fail' label much simpler, so it
> shouldn't have to handle the failed allocation case.
> 
> This also fixes a -Wshadow warning.
> 
> Signed-off-by: Brian Norris <computersforpeace@gmail.com>

Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>

> ---
>  drivers/mtd/nand/docg4.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/mtd/nand/docg4.c b/drivers/mtd/nand/docg4.c
> index cb6efadd712e..24d478d90dcc 100644
> --- a/drivers/mtd/nand/docg4.c
> +++ b/drivers/mtd/nand/docg4.c
> @@ -1353,14 +1353,10 @@ static int __init probe_docg4(struct platform_device *pdev)
>  	doc->mtd = mtd;
>  	return 0;
>  
> - fail:
> -	if (nand) {
> -		/* re-declarations avoid compiler warning */
> -		struct docg4_priv *doc = nand->priv;
> -		nand_release(mtd); /* deletes partitions and mtd devices */
> -		free_bch(doc->bch);
> -		kfree(nand);
> -	}
> +fail:
> +	nand_release(mtd); /* deletes partitions and mtd devices */
> +	free_bch(doc->bch);
> +	kfree(nand);
>  
>  fail_unmap:
>  	iounmap(virtadr);



-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

  reply	other threads:[~2015-12-18 20:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-18 19:39 [PATCH] mtd: nand: docg4: simplify error case Brian Norris
2015-12-18 20:24 ` Boris Brezillon [this message]
2015-12-18 20:43 ` Brian Norris

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=20151218212430.35579c90@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=computersforpeace@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).