All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Hennerich <michael.hennerich@analog.com>
To: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: "kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>,
	Richard Purdie <rpurdie@rpsys.net>,
	Florian Tobias Schandinat <FlorianSchandinat@gmx.de>,
	"device-drivers-devel@blackfin.uclinux.org"
	<device-drivers-devel@blackfin.uclinux.org>,
	"linux-fbdev@vger.kernel.org" <linux-fbdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 4/4] drivers/video/backlight/adp5520_bl.c: use devm_ functions
Date: Mon, 23 Jan 2012 08:32:03 +0000	[thread overview]
Message-ID: <4F1D1B03.90803@analog.com> (raw)
In-Reply-To: <1327094732-9050-5-git-send-email-Julia.Lawall@lip6.fr>

On 01/20/2012 10:25 PM, Julia Lawall wrote:
> From: Julia Lawall<Julia.Lawall@lip6.fr>
>
> The various devm_ functions allocate memory that is released when a driver
> detaches.  This patch uses these functions for data that is allocated in
> the probe function of a platform device and is only freed in the remove
> function.
>
> Signed-off-by: Julia Lawall<Julia.Lawall@lip6.fr>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
> ---
>   drivers/video/backlight/adp5520_bl.c |    6 +-----
>   1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/video/backlight/adp5520_bl.c b/drivers/video/backlight/adp5520_bl.c
> index 2e630bf..4911ea7 100644
> --- a/drivers/video/backlight/adp5520_bl.c
> +++ b/drivers/video/backlight/adp5520_bl.c
> @@ -289,7 +289,7 @@ static int __devinit adp5520_bl_probe(struct platform_device *pdev)
>   	struct adp5520_bl *data;
>   	int ret = 0;
>
> -	data = kzalloc(sizeof(*data), GFP_KERNEL);
> +	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
>   	if (data = NULL)
>   		return -ENOMEM;
>
> @@ -298,7 +298,6 @@ static int __devinit adp5520_bl_probe(struct platform_device *pdev)
>
>   	if (data->pdata  = NULL) {
>   		dev_err(&pdev->dev, "missing platform data\n");
> -		kfree(data);
>   		return -ENODEV;
>   	}
>
> @@ -314,7 +313,6 @@ static int __devinit adp5520_bl_probe(struct platform_device *pdev)
>   				&adp5520_bl_ops,&props);
>   	if (IS_ERR(bl)) {
>   		dev_err(&pdev->dev, "failed to register backlight\n");
> -		kfree(data);
>   		return PTR_ERR(bl);
>   	}
>
> @@ -326,7 +324,6 @@ static int __devinit adp5520_bl_probe(struct platform_device *pdev)
>   	if (ret) {
>   		dev_err(&pdev->dev, "failed to register sysfs\n");
>   		backlight_device_unregister(bl);
> -		kfree(data);
>   	}
>
>   	platform_set_drvdata(pdev, bl);
> @@ -348,7 +345,6 @@ static int __devexit adp5520_bl_remove(struct platform_device *pdev)
>   				&adp5520_bl_attr_group);
>
>   	backlight_device_unregister(bl);
> -	kfree(data);
>
>   	return 0;
>   }
>
>


-- 
Greetings,
Michael

--
Analog Devices GmbH      Wilhelm-Wagenfeld-Str. 6      80807 Muenchen
Sitz der Gesellschaft: Muenchen; Registergericht: Muenchen HRB 40368;
Geschaeftsfuehrer:Dr.Carsten Suckrow, Thomas Wessel, William A. Martin,
Margaret Seif



WARNING: multiple messages have this Message-ID (diff)
From: Michael Hennerich <michael.hennerich@analog.com>
To: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: "kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>,
	Richard Purdie <rpurdie@rpsys.net>,
	Florian Tobias Schandinat <FlorianSchandinat@gmx.de>,
	"device-drivers-devel@blackfin.uclinux.org" 
	<device-drivers-devel@blackfin.uclinux.org>,
	"linux-fbdev@vger.kernel.org" <linux-fbdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 4/4] drivers/video/backlight/adp5520_bl.c: use devm_ functions
Date: Mon, 23 Jan 2012 09:32:03 +0100	[thread overview]
Message-ID: <4F1D1B03.90803@analog.com> (raw)
In-Reply-To: <1327094732-9050-5-git-send-email-Julia.Lawall@lip6.fr>

On 01/20/2012 10:25 PM, Julia Lawall wrote:
> From: Julia Lawall<Julia.Lawall@lip6.fr>
>
> The various devm_ functions allocate memory that is released when a driver
> detaches.  This patch uses these functions for data that is allocated in
> the probe function of a platform device and is only freed in the remove
> function.
>
> Signed-off-by: Julia Lawall<Julia.Lawall@lip6.fr>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
> ---
>   drivers/video/backlight/adp5520_bl.c |    6 +-----
>   1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/video/backlight/adp5520_bl.c b/drivers/video/backlight/adp5520_bl.c
> index 2e630bf..4911ea7 100644
> --- a/drivers/video/backlight/adp5520_bl.c
> +++ b/drivers/video/backlight/adp5520_bl.c
> @@ -289,7 +289,7 @@ static int __devinit adp5520_bl_probe(struct platform_device *pdev)
>   	struct adp5520_bl *data;
>   	int ret = 0;
>
> -	data = kzalloc(sizeof(*data), GFP_KERNEL);
> +	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
>   	if (data == NULL)
>   		return -ENOMEM;
>
> @@ -298,7 +298,6 @@ static int __devinit adp5520_bl_probe(struct platform_device *pdev)
>
>   	if (data->pdata  == NULL) {
>   		dev_err(&pdev->dev, "missing platform data\n");
> -		kfree(data);
>   		return -ENODEV;
>   	}
>
> @@ -314,7 +313,6 @@ static int __devinit adp5520_bl_probe(struct platform_device *pdev)
>   				&adp5520_bl_ops,&props);
>   	if (IS_ERR(bl)) {
>   		dev_err(&pdev->dev, "failed to register backlight\n");
> -		kfree(data);
>   		return PTR_ERR(bl);
>   	}
>
> @@ -326,7 +324,6 @@ static int __devinit adp5520_bl_probe(struct platform_device *pdev)
>   	if (ret) {
>   		dev_err(&pdev->dev, "failed to register sysfs\n");
>   		backlight_device_unregister(bl);
> -		kfree(data);
>   	}
>
>   	platform_set_drvdata(pdev, bl);
> @@ -348,7 +345,6 @@ static int __devexit adp5520_bl_remove(struct platform_device *pdev)
>   				&adp5520_bl_attr_group);
>
>   	backlight_device_unregister(bl);
> -	kfree(data);
>
>   	return 0;
>   }
>
>


-- 
Greetings,
Michael

--
Analog Devices GmbH      Wilhelm-Wagenfeld-Str. 6      80807 Muenchen
Sitz der Gesellschaft: Muenchen; Registergericht: Muenchen HRB 40368;
Geschaeftsfuehrer:Dr.Carsten Suckrow, Thomas Wessel, William A. Martin,
Margaret Seif



  reply	other threads:[~2012-01-23  8:32 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-20 21:25 [PATCH 0/4] use devm_ functions Julia Lawall
2012-01-20 21:25 ` Julia Lawall
2012-01-20 21:25 ` [PATCH 1/4] drivers/video/backlight/wm831x_bl.c: " Julia Lawall
2012-01-20 21:25   ` Julia Lawall
2012-01-21 12:33   ` Mark Brown
2012-01-20 21:25 ` [PATCH 2/4] drivers/video/au*fb.c: " Julia Lawall
2012-01-20 21:25   ` Julia Lawall
2012-01-21 13:53   ` Florian Tobias Schandinat
2012-01-21 13:53     ` Florian Tobias Schandinat
2012-01-21 14:00     ` Manuel Lauss
2012-01-21 14:00       ` Manuel Lauss
2012-01-21 14:00       ` Manuel Lauss
2012-01-21 15:01       ` Julia Lawall
2012-01-21 15:01         ` Julia Lawall
2012-01-30  5:17         ` Florian Tobias Schandinat
2012-01-30  5:17           ` Florian Tobias Schandinat
2012-01-20 21:25 ` [PATCH 3/4] drivers/video/backlight: " Julia Lawall
2012-01-20 21:25   ` Julia Lawall
2012-01-20 21:25 ` [PATCH 4/4] drivers/video/backlight/adp5520_bl.c: " Julia Lawall
2012-01-20 21:25   ` Julia Lawall
2012-01-23  8:32   ` Michael Hennerich [this message]
2012-01-23  8:32     ` Michael Hennerich
2012-01-21 14:02 ` [PATCH 0/4] " Florian Tobias Schandinat
2012-01-21 14:02   ` Florian Tobias Schandinat

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=4F1D1B03.90803@analog.com \
    --to=michael.hennerich@analog.com \
    --cc=FlorianSchandinat@gmx.de \
    --cc=Julia.Lawall@lip6.fr \
    --cc=device-drivers-devel@blackfin.uclinux.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rpurdie@rpsys.net \
    /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.