Commit 807508c8 authored by Anton Vorontsov's avatar Anton Vorontsov Committed by Greg Kroah-Hartman

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: default avatarAnton Vorontsov <cbouatmailru@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 5cfc64ce
...@@ -380,17 +380,13 @@ struct platform_device *__init_or_module platform_device_register_resndata( ...@@ -380,17 +380,13 @@ struct platform_device *__init_or_module platform_device_register_resndata(
pdev->dev.parent = parent; pdev->dev.parent = parent;
if (res) { ret = platform_device_add_resources(pdev, res, num);
ret = platform_device_add_resources(pdev, res, num); if (ret)
if (ret) goto err;
goto err;
}
if (data) { ret = platform_device_add_data(pdev, data, size);
ret = platform_device_add_data(pdev, data, size); if (ret)
if (ret) goto err;
goto err;
}
ret = platform_device_add(pdev); ret = platform_device_add(pdev);
if (ret) { if (ret) {
...@@ -537,17 +533,13 @@ struct platform_device * __init_or_module platform_create_bundle( ...@@ -537,17 +533,13 @@ struct platform_device * __init_or_module platform_create_bundle(
goto err_out; goto err_out;
} }
if (res) { error = platform_device_add_resources(pdev, res, n_res);
error = platform_device_add_resources(pdev, res, n_res); if (error)
if (error) goto err_pdev_put;
goto err_pdev_put;
}
if (data) { error = platform_device_add_data(pdev, data, size);
error = platform_device_add_data(pdev, data, size); if (error)
if (error) goto err_pdev_put;
goto err_pdev_put;
}
error = platform_device_add(pdev); error = platform_device_add(pdev);
if (error) if (error)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment