Commit 3e61dfd8509a52d165726831c57b4c8a015d626c

Authored by Uwe Kleine-König
Committed by Greg Kroah-Hartman
1 parent f8a4bd3456

Driver core: use kmemdup in platform_device_add_resources

This makes platform_device_add_resources look like
platform_device_add_data.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

Showing 1 changed file with 3 additions and 3 deletions Side-by-side Diff

drivers/base/platform.c
... ... @@ -191,13 +191,13 @@
191 191 {
192 192 struct resource *r;
193 193  
194   - r = kmalloc(sizeof(struct resource) * num, GFP_KERNEL);
  194 + r = kmemdup(res, sizeof(struct resource) * num, GFP_KERNEL);
195 195 if (r) {
196   - memcpy(r, res, sizeof(struct resource) * num);
197 196 pdev->resource = r;
198 197 pdev->num_resources = num;
  198 + return 0;
199 199 }
200   - return r ? 0 : -ENOMEM;
  200 + return -ENOMEM;
201 201 }
202 202 EXPORT_SYMBOL_GPL(platform_device_add_resources);
203 203