Skip to content

Commit

Permalink
driver core/platform_device_add_data: free platform data before overw…
Browse files Browse the repository at this point in the history
…riting

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>
  • Loading branch information
Uwe Kleine-König authored and Greg Kroah-Hartman committed Apr 23, 2011
1 parent 27a33f9 commit 251e031
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/base/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 251e031

Please sign in to comment.