mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Raphaël Poggi" <poggi.raph@gmail.com>
To: barebox@lists.infradead.org
Subject: Re: [PATCH] mtd: atmel_nand: fix null pointer dereference
Date: Tue, 2 Sep 2014 21:04:48 +0200	[thread overview]
Message-ID: <CACqcpZD+pfL1M=iZSGbUu0B-VxArE9kXGrTuXDS-NAuKnz8H6g@mail.gmail.com> (raw)
In-Reply-To: <1409684561-19894-1-git-send-email-poggi.raph@gmail.com>

I think this patch could be squash in [PATCH v3 3/3] mtd: atmel_nand:
add support for device tree

2014-09-02 21:02 GMT+02:00 Raphaël Poggi <poggi.raph@gmail.com>:
> We need to allocate pdata for device tree and non device tree probe.
> In device tree probe we use pdata to fill structure member with dts data.
> In non device tree probe we use the pdata to handle platform_data.
>
> Signed-off-by: Raphaël Poggi <poggi.raph@gmail.com>
> ---
>  drivers/mtd/nand/atmel_nand.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
> index 910ecc3..1e7c6c6 100644
> --- a/drivers/mtd/nand/atmel_nand.c
> +++ b/drivers/mtd/nand/atmel_nand.c
> @@ -1194,6 +1194,10 @@ static int __init atmel_nand_probe(struct device_d *dev)
>         if (!host)
>                 return -ENOMEM;
>
> +       pdata = kzalloc(sizeof(struct atmel_nand_data), GFP_KERNEL);
> +       if (!pdata)
> +               return -ENOMEM;
> +
>         host->io_base = dev_request_mem_region(dev, 0);
>
>         mtd = &host->mtd;
> @@ -1206,10 +1210,6 @@ static int __init atmel_nand_probe(struct device_d *dev)
>                 if (res)
>                         goto err_no_card;
>         } else {
> -               pdata = kzalloc(sizeof(struct atmel_nand_data), GFP_KERNEL);
> -               if (!pdata)
> -                       return -ENOMEM;
> -
>                 memcpy(host->board, dev->platform_data, sizeof(struct atmel_nand_data));
>         }
>
> --
> 1.8.3.2
>

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2014-09-02 19:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-02 19:02 Raphaël Poggi
2014-09-02 19:04 ` Raphaël Poggi [this message]
2014-09-03  6:58   ` Sascha Hauer

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='CACqcpZD+pfL1M=iZSGbUu0B-VxArE9kXGrTuXDS-NAuKnz8H6g@mail.gmail.com' \
    --to=poggi.raph@gmail.com \
    --cc=barebox@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