From cbouatmailru@gmail.com Tue Sep 21 13:28:26 2010 Date: Tue, 7 Sep 2010 17:31:54 +0400 From: Anton Vorontsov To: Greg Kroah-Hartman Cc: Samuel Ortiz , Mark Brown , linux-kernel@vger.kernel.org Subject: base/platform: Simplifications for NULL platform data/resources handling Message-ID: <20100907133154.GB28139@oksana.dev.rtsoft.ru> Content-Disposition: inline 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 Signed-off-by: Greg Kroah-Hartman --- drivers/base/platform.c | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -380,17 +380,13 @@ struct platform_device *__init_or_module pdev->dev.parent = parent; - if (res) { - 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_resources(pdev, res, num); + 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_modul 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)