Hi Wei, On Sun, Apr 30, 2017 at 6:31 PM, Jonathan Cameron <jic23@xxxxxxxxxx> wrote: > On 27/04/17 16:14, Wei Yongjun wrote: >> From: Wei Yongjun <weiyongjun1@xxxxxxxxxx> >> >> In case of error, the function devm_ioremap() returns NULL pointer not >> ERR_PTR(). Use devm_ioremap_resource() instead of devm_ioremap(). >> >> Signed-off-by: Wei Yongjun <weiyongjun1@xxxxxxxxxx> > I'll be wanting a tested-by for this one. > > Thanks, > > Jonathan >> --- >> v1 -> v2: use devm_ioremap_resource() >> --- >> drivers/iio/adc/mxs-lradc-adc.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/iio/adc/mxs-lradc-adc.c b/drivers/iio/adc/mxs-lradc-adc.c >> index b0c7d8e..2faf65f 100644 >> --- a/drivers/iio/adc/mxs-lradc-adc.c >> +++ b/drivers/iio/adc/mxs-lradc-adc.c >> @@ -718,7 +718,7 @@ static int mxs_lradc_adc_probe(struct platform_device *pdev) >> adc->dev = dev; >> >> iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); >> - adc->base = devm_ioremap(dev, iores->start, resource_size(iores)); >> + adc->base = devm_ioremap_resource(dev, iores); >> if (IS_ERR(adc->base)) >> return PTR_ERR(adc->base); >> I tested your patch on i.mx28 and it causes probe failure. Here's dmesg output: [ 3.065959] mxs-lradc-adc mxs-lradc-adc: can't request region for resource [mem 0x80050000-0x80051fff] [ 3.075537] mxs-lradc-adc: probe of mxs-lradc-adc failed with error -16 Ksenija -- 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