All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ryan Mallon <rmallon@gmail.com>
To: Julia Lawall <julia@diku.dk>
Cc: Scott Branden <sbranden@broadcom.com>,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mtd@lists.infradead.org,
	Jiandong Zheng <jdzheng@broadcom.com>,
	David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH] drivers/mtd/nand/bcm_umi_nand.c: add missing kfree/ioremap
Date: Wed, 10 Aug 2011 06:01:43 +0000	[thread overview]
Message-ID: <4E421EC7.6090505@gmail.com> (raw)
In-Reply-To: <1312954935-14592-1-git-send-email-julia@diku.dk>

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


WARNING: multiple messages have this Message-ID (diff)
From: Ryan Mallon <rmallon@gmail.com>
To: Julia Lawall <julia@diku.dk>
Cc: Scott Branden <sbranden@broadcom.com>,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mtd@lists.infradead.org,
	Jiandong Zheng <jdzheng@broadcom.com>,
	David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH] drivers/mtd/nand/bcm_umi_nand.c: add missing kfree/ioremap
Date: Wed, 10 Aug 2011 16:01:43 +1000	[thread overview]
Message-ID: <4E421EC7.6090505@gmail.com> (raw)
In-Reply-To: <1312954935-14592-1-git-send-email-julia@diku.dk>

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

WARNING: multiple messages have this Message-ID (diff)
From: Ryan Mallon <rmallon@gmail.com>
To: Julia Lawall <julia@diku.dk>
Cc: Jiandong Zheng <jdzheng@broadcom.com>,
	kernel-janitors@vger.kernel.org,
	Scott Branden <sbranden@broadcom.com>,
	David Woodhouse <dwmw2@infradead.org>,
	linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drivers/mtd/nand/bcm_umi_nand.c: add missing kfree/ioremap
Date: Wed, 10 Aug 2011 16:01:43 +1000	[thread overview]
Message-ID: <4E421EC7.6090505@gmail.com> (raw)
In-Reply-To: <1312954935-14592-1-git-send-email-julia@diku.dk>

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


  parent reply	other threads:[~2011-08-10  6:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-10  5:42 [PATCH] drivers/mtd/nand/bcm_umi_nand.c: add missing kfree/ioremap Julia Lawall
2011-08-10  5:42 ` Julia Lawall
2011-08-10  5:42 ` Julia Lawall
2011-08-10  5:49 ` Julia Lawall
2011-08-10  5:49   ` Julia Lawall
2011-08-10  5:49   ` Julia Lawall
2011-08-10  6:01 ` Ryan Mallon [this message]
2011-08-10  6:01   ` Ryan Mallon
2011-08-10  6:01   ` Ryan Mallon
2011-08-10  6:11   ` Julia Lawall
2011-08-10  6:11     ` Julia Lawall
2011-08-10  6:11     ` Julia Lawall

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=4E421EC7.6090505@gmail.com \
    --to=rmallon@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=jdzheng@broadcom.com \
    --cc=julia@diku.dk \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=sbranden@broadcom.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.