* [PATCH 5/5] drivers/video/msm/mddi_client_nt35399.c: use devm_ functions
[not found] <1344008414-2894-1-git-send-email-damien.cassou@lifl.fr>
@ 2012-08-03 15:40 ` Damien Cassou
2012-08-06 9:06 ` Dan Carpenter
` (2 more replies)
2012-08-03 15:40 ` [PATCH 4/5] drivers/video/msm/mddi_client_dummy.c: " Damien Cassou
1 sibling, 3 replies; 8+ messages in thread
From: Damien Cassou @ 2012-08-03 15:40 UTC (permalink / raw)
To: David Brown
Cc: kernel-janitors, Daniel Walker, Bryan Huntsman,
Florian Tobias Schandinat, linux-arm-msm, linux-fbdev,
linux-kernel
From: Damien Cassou <damien.cassou@lifl.fr>
The various devm_ functions allocate memory that is released when a driver
detaches. This patch replaces the use of kzalloc by devm_kzalloc.
Additionally, this patch fixes a memory leak: some memory was allocated for
'panel' but not released when the subsequent call to setup_vsync fails.
Signed-off-by: Damien Cassou <damien.cassou@lifl.fr>
---
drivers/video/msm/mddi_client_nt35399.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/video/msm/mddi_client_nt35399.c b/drivers/video/msm/mddi_client_nt35399.c
index 7fcd67e..66b314e 100644
--- a/drivers/video/msm/mddi_client_nt35399.c
+++ b/drivers/video/msm/mddi_client_nt35399.c
@@ -189,8 +189,9 @@ static int mddi_nt35399_probe(struct platform_device *pdev)
int ret;
- struct panel_info *panel = kzalloc(sizeof(struct panel_info),
- GFP_KERNEL);
+ struct panel_info *panel = devm_kzalloc(&pdev->dev,
+ sizeof(struct panel_info),
+ GFP_KERNEL);
printk(KERN_DEBUG "%s: enter.\n", __func__);
@@ -233,7 +234,6 @@ static int mddi_nt35399_remove(struct platform_device *pdev)
struct panel_info *panel = platform_get_drvdata(pdev);
setup_vsync(panel, 0);
- kfree(panel);
return 0;
}
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/5] drivers/video/msm/mddi_client_dummy.c: use devm_ functions
[not found] <1344008414-2894-1-git-send-email-damien.cassou@lifl.fr>
2012-08-03 15:40 ` [PATCH 5/5] drivers/video/msm/mddi_client_nt35399.c: use devm_ functions Damien Cassou
@ 2012-08-03 15:40 ` Damien Cassou
2012-08-09 17:39 ` David Brown
2012-08-09 17:57 ` David Brown
1 sibling, 2 replies; 8+ messages in thread
From: Damien Cassou @ 2012-08-03 15:40 UTC (permalink / raw)
To: David Brown
Cc: kernel-janitors, Daniel Walker, Bryan Huntsman,
Florian Tobias Schandinat, linux-arm-msm, linux-fbdev,
linux-kernel
From: Damien Cassou <damien.cassou@lifl.fr>
The various devm_ functions allocate memory that is released when a driver
detaches. This patch replaces the use of kzalloc by devm_kzalloc.
Signed-off-by: Damien Cassou <damien.cassou@lifl.fr>
---
drivers/video/msm/mddi_client_dummy.c | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/drivers/video/msm/mddi_client_dummy.c b/drivers/video/msm/mddi_client_dummy.c
index d2a091c..4c31325 100644
--- a/drivers/video/msm/mddi_client_dummy.c
+++ b/drivers/video/msm/mddi_client_dummy.c
@@ -51,7 +51,7 @@ static int mddi_dummy_probe(struct platform_device *pdev)
{
struct msm_mddi_client_data *client_data = pdev->dev.platform_data;
struct panel_info *panel =
- kzalloc(sizeof(struct panel_info), GFP_KERNEL);
+ devm_kzalloc(&pdev->dev, sizeof(struct panel_info), GFP_KERNEL);
int ret;
if (!panel)
return -ENOMEM;
@@ -67,18 +67,11 @@ static int mddi_dummy_probe(struct platform_device *pdev)
client_data->fb_resource, 1);
panel->panel_data.fb_data = client_data->private_client_data;
panel->pdev.dev.platform_data = &panel->panel_data;
- ret = platform_device_register(&panel->pdev);
- if (ret) {
- kfree(panel);
- return ret;
- }
- return 0;
+ return platform_device_register(&panel->pdev);
}
static int mddi_dummy_remove(struct platform_device *pdev)
{
- struct panel_info *panel = platform_get_drvdata(pdev);
- kfree(panel);
return 0;
}
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 5/5] drivers/video/msm/mddi_client_nt35399.c: use devm_ functions
2012-08-03 15:40 ` [PATCH 5/5] drivers/video/msm/mddi_client_nt35399.c: use devm_ functions Damien Cassou
@ 2012-08-06 9:06 ` Dan Carpenter
2012-08-09 17:38 ` David Brown
2012-08-23 20:42 ` Florian Tobias Schandinat
2 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2012-08-06 9:06 UTC (permalink / raw)
To: Damien Cassou
Cc: David Brown, kernel-janitors, Daniel Walker, Bryan Huntsman,
Florian Tobias Schandinat, linux-arm-msm, linux-fbdev,
linux-kernel
On Fri, Aug 03, 2012 at 05:40:13PM +0200, Damien Cassou wrote:
> @@ -233,7 +234,6 @@ static int mddi_nt35399_remove(struct platform_device *pdev)
> struct panel_info *panel = platform_get_drvdata(pdev);
>
> setup_vsync(panel, 0);
> - kfree(panel);
> return 0;
> }
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
It's weird. This patch doesn't apply for me unless I add a blank
line between the "}" and the "--". I'm not sure if that line is
getting removed by your email client or by the kernel janitors email
list.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 5/5] drivers/video/msm/mddi_client_nt35399.c: use devm_ functions
2012-08-03 15:40 ` [PATCH 5/5] drivers/video/msm/mddi_client_nt35399.c: use devm_ functions Damien Cassou
2012-08-06 9:06 ` Dan Carpenter
@ 2012-08-09 17:38 ` David Brown
2012-08-23 20:42 ` Florian Tobias Schandinat
2 siblings, 0 replies; 8+ messages in thread
From: David Brown @ 2012-08-09 17:38 UTC (permalink / raw)
To: Damien Cassou
Cc: kernel-janitors, Daniel Walker, Bryan Huntsman,
Florian Tobias Schandinat, linux-arm-msm, linux-fbdev,
linux-kernel
On Fri, Aug 03, 2012 at 05:40:13PM +0200, Damien Cassou wrote:
> From: Damien Cassou <damien.cassou@lifl.fr>
>
> The various devm_ functions allocate memory that is released when a driver
> detaches. This patch replaces the use of kzalloc by devm_kzalloc.
>
> Additionally, this patch fixes a memory leak: some memory was allocated for
> 'panel' but not released when the subsequent call to setup_vsync fails.
>
> Signed-off-by: Damien Cassou <damien.cassou@lifl.fr>
Acked-by: David Brown <davidb@codeaurora.org>
--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 4/5] drivers/video/msm/mddi_client_dummy.c: use devm_ functions
2012-08-03 15:40 ` [PATCH 4/5] drivers/video/msm/mddi_client_dummy.c: " Damien Cassou
@ 2012-08-09 17:39 ` David Brown
2012-08-09 17:57 ` David Brown
1 sibling, 0 replies; 8+ messages in thread
From: David Brown @ 2012-08-09 17:39 UTC (permalink / raw)
To: Damien Cassou
Cc: kernel-janitors, Daniel Walker, Bryan Huntsman,
Florian Tobias Schandinat, linux-arm-msm, linux-fbdev,
linux-kernel
On Fri, Aug 03, 2012 at 05:40:14PM +0200, Damien Cassou wrote:
> From: Damien Cassou <damien.cassou@lifl.fr>
>
> The various devm_ functions allocate memory that is released when a driver
> detaches. This patch replaces the use of kzalloc by devm_kzalloc.
>
> Signed-off-by: Damien Cassou <damien.cassou@lifl.fr>
>
> ---
> drivers/video/msm/mddi_client_dummy.c | 12 ++----------
> 1 file changed, 2 insertions(+), 10 deletions(-)
Acked-by: David Brown <davidb@codeaurora.org>
--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 4/5] drivers/video/msm/mddi_client_dummy.c: use devm_ functions
2012-08-03 15:40 ` [PATCH 4/5] drivers/video/msm/mddi_client_dummy.c: " Damien Cassou
2012-08-09 17:39 ` David Brown
@ 2012-08-09 17:57 ` David Brown
2012-08-28 8:42 ` Damien Cassou
1 sibling, 1 reply; 8+ messages in thread
From: David Brown @ 2012-08-09 17:57 UTC (permalink / raw)
To: Damien Cassou
Cc: kernel-janitors, Daniel Walker, Bryan Huntsman,
Florian Tobias Schandinat, linux-arm-msm, linux-fbdev,
linux-kernel
On Fri, Aug 03, 2012 at 05:40:14PM +0200, Damien Cassou wrote:
> From: Damien Cassou <damien.cassou@lifl.fr>
>
> The various devm_ functions allocate memory that is released when a driver
> detaches. This patch replaces the use of kzalloc by devm_kzalloc.
>
> Signed-off-by: Damien Cassou <damien.cassou@lifl.fr>
>
> ---
> drivers/video/msm/mddi_client_dummy.c | 12 ++----------
> 1 file changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/video/msm/mddi_client_dummy.c b/drivers/video/msm/mddi_client_dummy.c
> index d2a091c..4c31325 100644
> --- a/drivers/video/msm/mddi_client_dummy.c
> +++ b/drivers/video/msm/mddi_client_dummy.c
> @@ -51,7 +51,7 @@ static int mddi_dummy_probe(struct platform_device *pdev)
> {
> struct msm_mddi_client_data *client_data = pdev->dev.platform_data;
> struct panel_info *panel =
> - kzalloc(sizeof(struct panel_info), GFP_KERNEL);
> + devm_kzalloc(&pdev->dev, sizeof(struct panel_info), GFP_KERNEL);
> int ret;
> if (!panel)
> return -ENOMEM;
> @@ -67,18 +67,11 @@ static int mddi_dummy_probe(struct platform_device *pdev)
> client_data->fb_resource, 1);
> panel->panel_data.fb_data = client_data->private_client_data;
> panel->pdev.dev.platform_data = &panel->panel_data;
> - ret = platform_device_register(&panel->pdev);
> - if (ret) {
> - kfree(panel);
> - return ret;
> - }
> - return 0;
> + return platform_device_register(&panel->pdev);
Removing this block causes a warning:
kernel/drivers/video/msm/mddi_client_dummy.c: In function 'mddi_dummy_probe':
kernel/drivers/video/msm/mddi_client_dummy.c:55:6: warning: unused variable 'ret' [-Wunused-variable]
Please remove the 'int ret;' line above as well.
Thanks,
David Brown
--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 5/5] drivers/video/msm/mddi_client_nt35399.c: use devm_ functions
2012-08-03 15:40 ` [PATCH 5/5] drivers/video/msm/mddi_client_nt35399.c: use devm_ functions Damien Cassou
2012-08-06 9:06 ` Dan Carpenter
2012-08-09 17:38 ` David Brown
@ 2012-08-23 20:42 ` Florian Tobias Schandinat
2 siblings, 0 replies; 8+ messages in thread
From: Florian Tobias Schandinat @ 2012-08-23 20:42 UTC (permalink / raw)
To: Damien Cassou
Cc: David Brown, kernel-janitors, Daniel Walker, Bryan Huntsman,
linux-arm-msm, linux-fbdev, linux-kernel
On 08/03/2012 03:40 PM, Damien Cassou wrote:
> From: Damien Cassou <damien.cassou@lifl.fr>
>
> The various devm_ functions allocate memory that is released when a driver
> detaches. This patch replaces the use of kzalloc by devm_kzalloc.
>
> Additionally, this patch fixes a memory leak: some memory was allocated for
> 'panel' but not released when the subsequent call to setup_vsync fails.
>
> Signed-off-by: Damien Cassou <damien.cassou@lifl.fr>
Applied.
Thanks,
Florian Tobias Schandinat
>
> ---
> drivers/video/msm/mddi_client_nt35399.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/video/msm/mddi_client_nt35399.c b/drivers/video/msm/mddi_client_nt35399.c
> index 7fcd67e..66b314e 100644
> --- a/drivers/video/msm/mddi_client_nt35399.c
> +++ b/drivers/video/msm/mddi_client_nt35399.c
> @@ -189,8 +189,9 @@ static int mddi_nt35399_probe(struct platform_device *pdev)
>
> int ret;
>
> - struct panel_info *panel = kzalloc(sizeof(struct panel_info),
> - GFP_KERNEL);
> + struct panel_info *panel = devm_kzalloc(&pdev->dev,
> + sizeof(struct panel_info),
> + GFP_KERNEL);
>
> printk(KERN_DEBUG "%s: enter.\n", __func__);
>
> @@ -233,7 +234,6 @@ static int mddi_nt35399_remove(struct platform_device *pdev)
> struct panel_info *panel = platform_get_drvdata(pdev);
>
> setup_vsync(panel, 0);
> - kfree(panel);
> return 0;
> }
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 4/5] drivers/video/msm/mddi_client_dummy.c: use devm_ functions
2012-08-09 17:57 ` David Brown
@ 2012-08-28 8:42 ` Damien Cassou
0 siblings, 0 replies; 8+ messages in thread
From: Damien Cassou @ 2012-08-28 8:42 UTC (permalink / raw)
To: David Brown
Cc: kernel-janitors, Daniel Walker, Bryan Huntsman,
Florian Tobias Schandinat, linux-arm-msm, linux-fbdev,
linux-kernel
On Thu, Aug 9, 2012 at 7:57 PM, David Brown <davidb@codeaurora.org> wrote:
> Removing this block causes a warning:
> kernel/drivers/video/msm/mddi_client_dummy.c: In function 'mddi_dummy_probe':
> kernel/drivers/video/msm/mddi_client_dummy.c:55:6: warning: unused variable 'ret' [-Wunused-variable]
>
> Please remove the 'int ret;' line above as well.
Thank you for your feedback.
Please ignore this thread and patch. I've just sent a new email with
corrected patch.
--
Damien Cassou
http://damiencassou.seasidehosting.st
"Lambdas are relegated to relative obscurity until Java makes them
popular by not having them." James Iry
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-08-28 8:42 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1344008414-2894-1-git-send-email-damien.cassou@lifl.fr>
2012-08-03 15:40 ` [PATCH 5/5] drivers/video/msm/mddi_client_nt35399.c: use devm_ functions Damien Cassou
2012-08-06 9:06 ` Dan Carpenter
2012-08-09 17:38 ` David Brown
2012-08-23 20:42 ` Florian Tobias Schandinat
2012-08-03 15:40 ` [PATCH 4/5] drivers/video/msm/mddi_client_dummy.c: " Damien Cassou
2012-08-09 17:39 ` David Brown
2012-08-09 17:57 ` David Brown
2012-08-28 8:42 ` Damien Cassou
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).