[4/6] gpu: drm: tegra: Free platform data on remove

Submitted by Terje Bergström on Nov. 22, 2012, 9:48 a.m.

Details

Message ID 1353577684-7896-5-git-send-email-tbergstrom@nvidia.com
State Not Applicable, archived
Headers show

Commit Message

Terje Bergström Nov. 22, 2012, 9:48 a.m.
From: Arto Merilainen <amerilainen@nvidia.com>

Platform data was not freed in device removal. This patch adds
missing devm_kfree() calls.

Change-Id: Id00fd1940e786dbc80c7ac5a1bd4d6a4c18720a1
Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
---
 drivers/gpu/drm/tegra/dc.c   |    3 +++
 drivers/gpu/drm/tegra/dsi.c  |    3 +++
 drivers/gpu/drm/tegra/hdmi.c |    3 +++
 drivers/gpu/drm/tegra/tvo.c  |    3 +++
 4 files changed, 12 insertions(+)

Comments

Thierry Reding Nov. 23, 2012, 9:53 p.m.
On Thu, Nov 22, 2012 at 11:48:02AM +0200, Terje Bergstrom wrote:
> From: Arto Merilainen <amerilainen@nvidia.com>
> 
> Platform data was not freed in device removal. This patch adds
> missing devm_kfree() calls.
> 
> Change-Id: Id00fd1940e786dbc80c7ac5a1bd4d6a4c18720a1
> Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
> Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
> ---
>  drivers/gpu/drm/tegra/dc.c   |    3 +++
>  drivers/gpu/drm/tegra/dsi.c  |    3 +++
>  drivers/gpu/drm/tegra/hdmi.c |    3 +++
>  drivers/gpu/drm/tegra/tvo.c  |    3 +++
>  4 files changed, 12 insertions(+)

All of this is unnecessary. The reason for using the managed allocations
in the first place is because the memory is automatically freed when the
device is removed.

Thierry
Arto Merilainen Nov. 26, 2012, 7:33 a.m.
Thank you for your comments, I will drop this patch.

- Arto

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
index 5ccb809..b9e5a79 100644
--- a/drivers/gpu/drm/tegra/dc.c
+++ b/drivers/gpu/drm/tegra/dc.c
@@ -818,6 +818,9 @@  static int tegra_dc_remove(struct platform_device *pdev)
 
 	clk_disable_unprepare(dc->clk);
 
+	platform_set_drvdata(pdev, NULL);
+	devm_kfree(&pdev->dev, dc);
+
 	return 0;
 }
 
diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c
index 4f4c709..bba1c61 100644
--- a/drivers/gpu/drm/tegra/dsi.c
+++ b/drivers/gpu/drm/tegra/dsi.c
@@ -149,6 +149,9 @@  static int tegra_dsi_remove(struct platform_device *pdev)
 		return err;
 	}
 
+	platform_set_drvdata(pdev, NULL);
+	devm_kfree(&pdev->dev, dsi);
+
 	return 0;
 }
 
diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c
index b2b8e58..72032e8 100644
--- a/drivers/gpu/drm/tegra/hdmi.c
+++ b/drivers/gpu/drm/tegra/hdmi.c
@@ -1312,6 +1312,9 @@  static int tegra_hdmi_remove(struct platform_device *pdev)
 	clk_unprepare(hdmi->clk_parent);
 	clk_unprepare(hdmi->clk);
 
+	platform_set_drvdata(pdev, NULL);
+	devm_kfree(&pdev->dev, hdmi);
+
 	return 0;
 }
 
diff --git a/drivers/gpu/drm/tegra/tvo.c b/drivers/gpu/drm/tegra/tvo.c
index 01ac356..c6219b3 100644
--- a/drivers/gpu/drm/tegra/tvo.c
+++ b/drivers/gpu/drm/tegra/tvo.c
@@ -159,6 +159,9 @@  static int tegra_tvo_remove(struct platform_device *pdev)
 		return err;
 	}
 
+	platform_set_drvdata(pdev, NULL);
+	devm_kfree(&pdev->dev, tvo);
+
 	return 0;
 }