From 3e61dfd8509a52d165726831c57b4c8a015d626c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Tue, 15 Jun 2010 10:47:55 +0200 Subject: Driver core: use kmemdup in platform_device_add_resources MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes platform_device_add_resources look like platform_device_add_data. Signed-off-by: Uwe Kleine-König Signed-off-by: Greg Kroah-Hartman --- drivers/base/platform.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/base/platform.c') diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 4d99c8b..26eb69d 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -191,13 +191,13 @@ int platform_device_add_resources(struct platform_device *pdev, { struct resource *r; - r = kmalloc(sizeof(struct resource) * num, GFP_KERNEL); + r = kmemdup(res, sizeof(struct resource) * num, GFP_KERNEL); if (r) { - memcpy(r, res, sizeof(struct resource) * num); pdev->resource = r; pdev->num_resources = num; + return 0; } - return r ? 0 : -ENOMEM; + return -ENOMEM; } EXPORT_SYMBOL_GPL(platform_device_add_resources); -- cgit v1.1