diff options
author | Anton Vorontsov <cbouatmailru@gmail.com> | 2010-09-07 15:31:54 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-10-22 19:16:43 +0200 |
commit | 807508c8ff9af6ce8f25c5ca5f3eb06a8e7d3286 (patch) | |
tree | d6e65154b1e26fa15f92e54cdf8829a9c5e9861b /drivers | |
parent | base/platform: Safe handling for NULL platform data and resources (diff) | |
download | linux-807508c8ff9af6ce8f25c5ca5f3eb06a8e7d3286.tar.xz linux-807508c8ff9af6ce8f25c5ca5f3eb06a8e7d3286.zip |
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')
-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( pdev->dev.parent = parent; - if (res) { - ret = platform_device_add_resources(pdev, res, num); - if (ret) - goto err; - } + ret = platform_device_add_resources(pdev, res, num); + if (ret) + goto err; - if (data) { - ret = platform_device_add_data(pdev, data, size); - if (ret) - goto err; - } + ret = platform_device_add_data(pdev, data, size); + if (ret) + goto err; ret = platform_device_add(pdev); if (ret) { @@ -537,17 +533,13 @@ struct platform_device * __init_or_module platform_create_bundle( goto err_out; } - if (res) { - error = platform_device_add_resources(pdev, res, n_res); - if (error) - goto err_pdev_put; - } + error = platform_device_add_resources(pdev, res, n_res); + if (error) + goto err_pdev_put; - if (data) { - error = platform_device_add_data(pdev, data, size); - if (error) - goto err_pdev_put; - } + error = platform_device_add_data(pdev, data, size); + if (error) + goto err_pdev_put; error = platform_device_add(pdev); if (error) |