* [PATCH] drivers/mtd/nand/bcm_umi_nand.c: add missing kfree/ioremap
@ 2011-08-10 5:42 Julia Lawall
2011-08-10 5:49 ` Julia Lawall
2011-08-10 6:01 ` Ryan Mallon
0 siblings, 2 replies; 4+ messages in thread
From: Julia Lawall @ 2011-08-10 5:42 UTC (permalink / raw)
To: Jiandong Zheng
Cc: David Woodhouse, linux-mtd, kernel-janitors, linux-kernel,
Scott Branden
From: Julia Lawall <julia@diku.dk>
The error handling code under the #if should be the same as elsewhere in
the function.
Signed-off-by: Julia Lawall <julia@diku.dk>
---
drivers/mtd/nand/bcm_umi_nand.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/nand/bcm_umi_nand.c b/drivers/mtd/nand/bcm_umi_nand.c
index a8ae898..72e8ec2 100644
--- a/drivers/mtd/nand/bcm_umi_nand.c
+++ b/drivers/mtd/nand/bcm_umi_nand.c
@@ -433,8 +433,11 @@ static int __devinit bcm_umi_nand_probe(struct platform_device *pdev)
#if USE_DMA
err = nand_dma_init();
- if (err != 0)
+ if (err != 0) {
+ iounmap(bcm_umi_io_base);
+ kfree(board_mtd);
return err;
+ }
#endif
/* Figure out the size of the device that we have.
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] drivers/mtd/nand/bcm_umi_nand.c: add missing kfree/ioremap
2011-08-10 5:42 [PATCH] drivers/mtd/nand/bcm_umi_nand.c: add missing kfree/ioremap Julia Lawall
@ 2011-08-10 5:49 ` Julia Lawall
2011-08-10 6:01 ` Ryan Mallon
1 sibling, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2011-08-10 5:49 UTC (permalink / raw)
To: Jiandong Zheng
Cc: David Woodhouse, linux-mtd, kernel-janitors, linux-kernel,
Scott Branden
Oops, please ignore this patch. I missed another similar problem in the
same function.
julia
On Wed, 10 Aug 2011, Julia Lawall wrote:
> From: Julia Lawall <julia@diku.dk>
>
> The error handling code under the #if should be the same as elsewhere in
> the function.
>
> Signed-off-by: Julia Lawall <julia@diku.dk>
>
> ---
> drivers/mtd/nand/bcm_umi_nand.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/nand/bcm_umi_nand.c b/drivers/mtd/nand/bcm_umi_nand.c
> index a8ae898..72e8ec2 100644
> --- a/drivers/mtd/nand/bcm_umi_nand.c
> +++ b/drivers/mtd/nand/bcm_umi_nand.c
> @@ -433,8 +433,11 @@ static int __devinit bcm_umi_nand_probe(struct platform_device *pdev)
>
> #if USE_DMA
> err = nand_dma_init();
> - if (err != 0)
> + if (err != 0) {
> + iounmap(bcm_umi_io_base);
> + kfree(board_mtd);
> return err;
> + }
> #endif
>
> /* Figure out the size of the device that we have.
>
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] drivers/mtd/nand/bcm_umi_nand.c: add missing kfree/ioremap
2011-08-10 5:42 [PATCH] drivers/mtd/nand/bcm_umi_nand.c: add missing kfree/ioremap Julia Lawall
2011-08-10 5:49 ` Julia Lawall
@ 2011-08-10 6:01 ` Ryan Mallon
2011-08-10 6:11 ` Julia Lawall
1 sibling, 1 reply; 4+ messages in thread
From: Ryan Mallon @ 2011-08-10 6:01 UTC (permalink / raw)
To: Julia Lawall
Cc: Scott Branden, kernel-janitors, linux-kernel, linux-mtd,
Jiandong Zheng, David Woodhouse
On 10/08/11 15:42, Julia Lawall wrote:
> From: Julia Lawall<julia@diku.dk>
>
> The error handling code under the #if should be the same as elsewhere in
> the function.
>
> Signed-off-by: Julia Lawall<julia@diku.dk>
>
> ---
> drivers/mtd/nand/bcm_umi_nand.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/nand/bcm_umi_nand.c b/drivers/mtd/nand/bcm_umi_nand.c
> index a8ae898..72e8ec2 100644
> --- a/drivers/mtd/nand/bcm_umi_nand.c
> +++ b/drivers/mtd/nand/bcm_umi_nand.c
> @@ -433,8 +433,11 @@ static int __devinit bcm_umi_nand_probe(struct platform_device *pdev)
>
> #if USE_DMA
> err = nand_dma_init();
> - if (err != 0)
> + if (err != 0) {
> + iounmap(bcm_umi_io_base);
> + kfree(board_mtd);
> return err;
> + }
> #endif
This probe function should possibly use goto exits on failure. It
reduces a bit of code duplication and helps prevent this type of error.
~Ryan
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] drivers/mtd/nand/bcm_umi_nand.c: add missing kfree/ioremap
2011-08-10 6:01 ` Ryan Mallon
@ 2011-08-10 6:11 ` Julia Lawall
0 siblings, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2011-08-10 6:11 UTC (permalink / raw)
To: Ryan Mallon
Cc: Scott Branden, kernel-janitors, linux-kernel, linux-mtd,
Jiandong Zheng, David Woodhouse
On Wed, 10 Aug 2011, Ryan Mallon wrote:
> On 10/08/11 15:42, Julia Lawall wrote:
> > From: Julia Lawall<julia@diku.dk>
> >
> > The error handling code under the #if should be the same as elsewhere in
> > the function.
> >
> > Signed-off-by: Julia Lawall<julia@diku.dk>
> >
> > ---
> > drivers/mtd/nand/bcm_umi_nand.c | 5 ++++-
> > 1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/mtd/nand/bcm_umi_nand.c
> > b/drivers/mtd/nand/bcm_umi_nand.c
> > index a8ae898..72e8ec2 100644
> > --- a/drivers/mtd/nand/bcm_umi_nand.c
> > +++ b/drivers/mtd/nand/bcm_umi_nand.c
> > @@ -433,8 +433,11 @@ static int __devinit bcm_umi_nand_probe(struct
> platform_device *pdev)
> >
> > #if USE_DMA
> > err = nand_dma_init();
> > - if (err != 0)
> > + if (err != 0) {
> > + iounmap(bcm_umi_io_base);
> > + kfree(board_mtd);
> > return err;
> > + }
> > #endif
>
> This probe function should possibly use goto exits on failure. It reduces a
> bit of code duplication and helps prevent this type of error.
OK, I didn't want to make such a major change for only one new case. But
since there are three new cases, I will do that.
julia
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-08-10 6:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-10 5:42 [PATCH] drivers/mtd/nand/bcm_umi_nand.c: add missing kfree/ioremap Julia Lawall
2011-08-10 5:49 ` Julia Lawall
2011-08-10 6:01 ` Ryan Mallon
2011-08-10 6:11 ` Julia Lawall
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox