linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: nand: docg4: simplify error case
@ 2015-12-18 19:39 Brian Norris
  2015-12-18 20:24 ` Boris Brezillon
  2015-12-18 20:43 ` Brian Norris
  0 siblings, 2 replies; 3+ messages in thread
From: Brian Norris @ 2015-12-18 19:39 UTC (permalink / raw)
  To: linux-mtd; +Cc: Brian Norris, Boris Brezillon

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>
---
 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);
-- 
2.6.0.rc2.230.g3dd15c0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mtd: nand: docg4: simplify error case
  2015-12-18 19:39 [PATCH] mtd: nand: docg4: simplify error case Brian Norris
@ 2015-12-18 20:24 ` Boris Brezillon
  2015-12-18 20:43 ` Brian Norris
  1 sibling, 0 replies; 3+ messages in thread
From: Boris Brezillon @ 2015-12-18 20:24 UTC (permalink / raw)
  To: Brian Norris; +Cc: linux-mtd

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mtd: nand: docg4: simplify error case
  2015-12-18 19:39 [PATCH] mtd: nand: docg4: simplify error case Brian Norris
  2015-12-18 20:24 ` Boris Brezillon
@ 2015-12-18 20:43 ` Brian Norris
  1 sibling, 0 replies; 3+ messages in thread
From: Brian Norris @ 2015-12-18 20:43 UTC (permalink / raw)
  To: linux-mtd; +Cc: Boris Brezillon

On Fri, Dec 18, 2015 at 11:39:53AM -0800, Brian Norris 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>

Applied

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-12-18 20:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-18 19:39 [PATCH] mtd: nand: docg4: simplify error case Brian Norris
2015-12-18 20:24 ` Boris Brezillon
2015-12-18 20:43 ` Brian Norris

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).