lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 4 Jul 2012 15:40:41 +0800
From:	Bryan Wu <bryan.wu@...onical.com>
To:	linux-leds@...r.kernel.org, rpurdie@...ys.net,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 15/25] leds: convert ADP5520 LED driver to devm_kzalloc()
 and cleanup error exit path

On Wed, Jul 4, 2012 at 1:10 PM, Bryan Wu <bryan.wu@...onical.com> wrote:
> Cc: Michael Hennerich <hennerich@...ckfin.uclinux.org>
> Signed-off-by: Bryan Wu <bryan.wu@...onical.com>
> ---
>  drivers/leds/leds-adp5520.c |    8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/leds/leds-adp5520.c b/drivers/leds/leds-adp5520.c
> index b1400db..72b110f 100644
> --- a/drivers/leds/leds-adp5520.c
> +++ b/drivers/leds/leds-adp5520.c
> @@ -119,7 +119,8 @@ static int __devinit adp5520_led_probe(struct platform_device *pdev)
>                 return -EFAULT;
>         }
>
> -       led = kzalloc(sizeof(*led) * pdata->num_leds, GFP_KERNEL);
> +       led = devm_kzalloc(&pdev->dev, sizeof(*led) * pdata->num_leds,
> +                               GFP_KERNEL);
>         if (led == NULL) {
>                 dev_err(&pdev->dev, "failed to alloc memory\n");
>                 return -ENOMEM;
> @@ -129,7 +130,7 @@ static int __devinit adp5520_led_probe(struct platform_device *pdev)
>
>         if (ret) {
>                 dev_err(&pdev->dev, "failed to write\n");
> -               goto err_free;
> +               return ret
Missed one ";" at end of this line. I've fixed it in my devel branch.

Thanks,
-Bryan

>         }
>
>         for (i = 0; i < pdata->num_leds; ++i) {
> @@ -179,8 +180,6 @@ err:
>                 }
>         }
>
> -err_free:
> -       kfree(led);
>         return ret;
>  }
>
> @@ -200,7 +199,6 @@ static int __devexit adp5520_led_remove(struct platform_device *pdev)
>                 cancel_work_sync(&led[i].work);
>         }
>
> -       kfree(led);
>         return 0;
>  }
>
> --
> 1.7.10.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-leds" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Bryan Wu <bryan.wu@...onical.com>
Kernel Developer    +86.186-168-78255 Mobile
Canonical Ltd.      www.canonical.com
Ubuntu - Linux for human beings | www.ubuntu.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ