aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/platform.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-05-19 21:24:11 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-05-19 21:24:11 -0400
commit39ab05c8e0b519ff0a04a869f065746e6e8c3d95 (patch)
treee73f0ba74c4ea7a80dff9b2dd9445a3a74190e28 /drivers/base/platform.c
parent1477fcc290b3d5c2614bde98bf3b1154c538860d (diff)
parentc42d2237143fcf35cff642cefe2bcf7786aae312 (diff)
Merge branch 'driver-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6
* 'driver-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6: (44 commits) debugfs: Silence DEBUG_STRICT_USER_COPY_CHECKS=y warning sysfs: remove "last sysfs file:" line from the oops messages drivers/base/memory.c: fix warning due to "memory hotplug: Speed up add/remove when blocks are larger than PAGES_PER_SECTION" memory hotplug: Speed up add/remove when blocks are larger than PAGES_PER_SECTION SYSFS: Fix erroneous comments for sysfs_update_group(). driver core: remove the driver-model structures from the documentation driver core: Add the device driver-model structures to kerneldoc Translated Documentation/email-clients.txt RAW driver: Remove call to kobject_put(). reboot: disable usermodehelper to prevent fs access efivars: prevent oops on unload when efi is not enabled Allow setting of number of raw devices as a module parameter Introduce CONFIG_GOOGLE_FIRMWARE driver: Google Memory Console driver: Google EFI SMI x86: Better comments for get_bios_ebda() x86: get_bios_ebda_length() misc: fix ti-st build issues params.c: Use new strtobool function to process boolean inputs debugfs: move to new strtobool ... Fix up trivial conflicts in fs/debugfs/file.c due to the same patch being applied twice, and an unrelated cleanup nearby.
Diffstat (limited to 'drivers/base/platform.c')
-rw-r--r--drivers/base/platform.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 48425f183029..1c291af637b3 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -192,18 +192,18 @@ EXPORT_SYMBOL_GPL(platform_device_alloc);
192int platform_device_add_resources(struct platform_device *pdev, 192int platform_device_add_resources(struct platform_device *pdev,
193 const struct resource *res, unsigned int num) 193 const struct resource *res, unsigned int num)
194{ 194{
195 struct resource *r; 195 struct resource *r = NULL;
196 196
197 if (!res) 197 if (res) {
198 return 0; 198 r = kmemdup(res, sizeof(struct resource) * num, GFP_KERNEL);
199 199 if (!r)
200 r = kmemdup(res, sizeof(struct resource) * num, GFP_KERNEL); 200 return -ENOMEM;
201 if (r) {
202 pdev->resource = r;
203 pdev->num_resources = num;
204 return 0;
205 } 201 }
206 return -ENOMEM; 202
203 kfree(pdev->resource);
204 pdev->resource = r;
205 pdev->num_resources = num;
206 return 0;
207} 207}
208EXPORT_SYMBOL_GPL(platform_device_add_resources); 208EXPORT_SYMBOL_GPL(platform_device_add_resources);
209 209
@@ -220,17 +220,17 @@ EXPORT_SYMBOL_GPL(platform_device_add_resources);
220int platform_device_add_data(struct platform_device *pdev, const void *data, 220int platform_device_add_data(struct platform_device *pdev, const void *data,
221 size_t size) 221 size_t size)
222{ 222{
223 void *d; 223 void *d = NULL;
224 224
225 if (!data) 225 if (data) {
226 return 0; 226 d = kmemdup(data, size, GFP_KERNEL);
227 227 if (!d)
228 d = kmemdup(data, size, GFP_KERNEL); 228 return -ENOMEM;
229 if (d) {
230 pdev->dev.platform_data = d;
231 return 0;
232 } 229 }
233 return -ENOMEM; 230
231 kfree(pdev->dev.platform_data);
232 pdev->dev.platform_data = d;
233 return 0;
234} 234}
235EXPORT_SYMBOL_GPL(platform_device_add_data); 235EXPORT_SYMBOL_GPL(platform_device_add_data);
236 236