By using devm_ioremap_resource() the code can be simplified, as we no longer need to check whether platform_get_resource() succeeded or not, as this check is already performed in devm_ioremap_resource(). Signed-off-by: Fabio Estevam <fabio.estevam@xxxxxxx> --- drivers/iio/adc/mxs-lradc-adc.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/iio/adc/mxs-lradc-adc.c b/drivers/iio/adc/mxs-lradc-adc.c index 6888167..2faf65f 100644 --- a/drivers/iio/adc/mxs-lradc-adc.c +++ b/drivers/iio/adc/mxs-lradc-adc.c @@ -718,12 +718,9 @@ static int mxs_lradc_adc_probe(struct platform_device *pdev) adc->dev = dev; iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!iores) - return -EINVAL; - - adc->base = devm_ioremap(dev, iores->start, resource_size(iores)); - if (!adc->base) - return -ENOMEM; + adc->base = devm_ioremap_resource(dev, iores); + if (IS_ERR(adc->base)) + return PTR_ERR(adc->base); init_completion(&adc->completion); spin_lock_init(&adc->lock); -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html