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:34:08 +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 04/25] leds: convert LP3944 LED driver to devm_kzalloc()

On Wed, Jul 4, 2012 at 1:09 PM, Bryan Wu <bryan.wu@...onical.com> wrote:
> Cc: Antonio Ospite <ospite@...denti.unina.it>
> Signed-off-by: Bryan Wu <bryan.wu@...onical.com>
> ---
>  drivers/leds/leds-lp3944.c |    9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/leds/leds-lp3944.c b/drivers/leds/leds-lp3944.c
> index b8f9f0a..e8b1021 100644
> --- a/drivers/leds/leds-lp3944.c
> +++ b/drivers/leds/leds-lp3944.c
> @@ -393,7 +393,8 @@ static int __devinit lp3944_probe(struct i2c_client *client,
>                 return -ENODEV;
>         }
>
> -       data = kzalloc(sizeof(struct lp3944_data), GFP_KERNEL);
> +       data = devm_kzalloc(&pdev->dev, sizeof(struct lp3944_data),

Sorry, this should be "devm_kzalloc(&client->dev, sizeof(struct lp3944_data),"
I've put the right version in my devel branch.

Thanks,
-Bryan

> +                       GFP_KERNEL);
>         if (!data)
>                 return -ENOMEM;
>
> @@ -403,10 +404,8 @@ static int __devinit lp3944_probe(struct i2c_client *client,
>         mutex_init(&data->lock);
>
>         err = lp3944_configure(client, data, lp3944_pdata);
> -       if (err < 0) {
> -               kfree(data);
> +       if (err < 0)
>                 return err;
> -       }
>
>         dev_info(&client->dev, "lp3944 enabled\n");
>         return 0;
> @@ -431,8 +430,6 @@ static int __devexit lp3944_remove(struct i2c_client *client)
>                         break;
>                 }
>
> -       kfree(data);
> -
>         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