summaryrefslogtreecommitdiffstats
path: root/drivers/base/platform.c
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2011-04-20 09:44:43 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2011-04-23 02:09:12 +0200
commit251e031d132ea3d03e0a32f2240c67f449979c5d (patch)
tree83ee22c8d152196875959a58c3e5fb99544468e4 /drivers/base/platform.c
parentdriver core/platform_device_add_data: set platform_data to NULL if !data (diff)
downloadlinux-251e031d132ea3d03e0a32f2240c67f449979c5d.tar.xz
linux-251e031d132ea3d03e0a32f2240c67f449979c5d.zip
driver core/platform_device_add_data: free platform data before overwriting
Reviewed-by: Viresh Kumar <viresh.kumar@st.com> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base/platform.c')
-rw-r--r--drivers/base/platform.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 65cb4c397603..58ad8e8ad7a3 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -228,6 +228,7 @@ int platform_device_add_data(struct platform_device *pdev, const void *data,
return -ENOMEM;
}
+ kfree(pdev->dev.platform_data);
pdev->dev.platform_data = d;
return 0;
}