driver core/platform_device_add_resources: free resource 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>
This commit is contained in:
Uwe Kleine-König 2011-04-20 09:44:45 +02:00 committed by Greg Kroah-Hartman
parent cea896238f
commit 4a03d6f7c8

View File

@ -200,6 +200,7 @@ int platform_device_add_resources(struct platform_device *pdev,
return -ENOMEM;
}
kfree(pdev->resource);
pdev->resource = r;
pdev->num_resources = num;
return 0;