diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2011-04-20 03:44:43 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-04-22 20:09:12 -0400 |
commit | 251e031d132ea3d03e0a32f2240c67f449979c5d (patch) | |
tree | 83ee22c8d152196875959a58c3e5fb99544468e4 /drivers/base/platform.c | |
parent | 27a33f9e8fb203e71925257cf039fe6ec623c5d1 (diff) |
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.c | 1 |
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, | |||
228 | return -ENOMEM; | 228 | return -ENOMEM; |
229 | } | 229 | } |
230 | 230 | ||
231 | kfree(pdev->dev.platform_data); | ||
231 | pdev->dev.platform_data = d; | 232 | pdev->dev.platform_data = d; |
232 | return 0; | 233 | return 0; |
233 | } | 234 | } |