diff options
author | Anton Vorontsov <cbouatmailru@gmail.com> | 2010-09-07 09:31:54 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-10-22 13:16:43 -0400 |
commit | 807508c8ff9af6ce8f25c5ca5f3eb06a8e7d3286 (patch) | |
tree | d6e65154b1e26fa15f92e54cdf8829a9c5e9861b /drivers/base/platform.c | |
parent | 5cfc64ceb6222aabec640ba76e89529a8fc2c1f0 (diff) |
base/platform: Simplifications for NULL platform data/resources handling
There's no need to explicitly check for data and resources being NULL,
as platform_device_add_{data,resources}() do this internally nowadays.
This makes the code more linear and less indented.
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base/platform.c')
-rw-r--r-- | drivers/base/platform.c | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index c794fec1c435..3966e62ad019 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c | |||
@@ -380,17 +380,13 @@ struct platform_device *__init_or_module platform_device_register_resndata( | |||
380 | 380 | ||
381 | pdev->dev.parent = parent; | 381 | pdev->dev.parent = parent; |
382 | 382 | ||
383 | if (res) { | 383 | ret = platform_device_add_resources(pdev, res, num); |
384 | ret = platform_device_add_resources(pdev, res, num); | 384 | if (ret) |
385 | if (ret) | 385 | goto err; |
386 | goto err; | ||
387 | } | ||
388 | 386 | ||
389 | if (data) { | 387 | ret = platform_device_add_data(pdev, data, size); |
390 | ret = platform_device_add_data(pdev, data, size); | 388 | if (ret) |
391 | if (ret) | 389 | goto err; |
392 | goto err; | ||
393 | } | ||
394 | 390 | ||
395 | ret = platform_device_add(pdev); | 391 | ret = platform_device_add(pdev); |
396 | if (ret) { | 392 | if (ret) { |
@@ -537,17 +533,13 @@ struct platform_device * __init_or_module platform_create_bundle( | |||
537 | goto err_out; | 533 | goto err_out; |
538 | } | 534 | } |
539 | 535 | ||
540 | if (res) { | 536 | error = platform_device_add_resources(pdev, res, n_res); |
541 | error = platform_device_add_resources(pdev, res, n_res); | 537 | if (error) |
542 | if (error) | 538 | goto err_pdev_put; |
543 | goto err_pdev_put; | ||
544 | } | ||
545 | 539 | ||
546 | if (data) { | 540 | error = platform_device_add_data(pdev, data, size); |
547 | error = platform_device_add_data(pdev, data, size); | 541 | if (error) |
548 | if (error) | 542 | goto err_pdev_put; |
549 | goto err_pdev_put; | ||
550 | } | ||
551 | 543 | ||
552 | error = platform_device_add(pdev); | 544 | error = platform_device_add(pdev); |
553 | if (error) | 545 | if (error) |