Re: [PATCH -next v3] iio: adc: mxs-lradc: Fix return value check in mxs_lradc_adc_probe()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 21 May 2017 13:12:37 +0100
Jonathan Cameron <jic23@xxxxxxxxxx> wrote:

> On 16/05/17 16:26, Wei Yongjun wrote:
> > From: Wei Yongjun <weiyongjun1@xxxxxxxxxx>
> > 
> > In case of error, the function devm_ioremap() returns NULL pointer
> > not ERR_PTR(). The IS_ERR() test in the return value check should
> > be replaced with NULL test. Also add NULL test for iores.
> > 
> > Signed-off-by: Wei Yongjun <weiyongjun1@xxxxxxxxxx>  
> Hi Wei,
> 
> At the moment I haven't yet sent a pull request to Greg since the
> merge window closed.  Up shot is that I don't have the current version
> of this code in my tree just yet.  That should be sorted in the
> next week or so.  Please remind me if it looks like I have forgotten
> this patch.
> 
> Thanks,
> 
> Jonathan
Applied to the fixes-togreg branch of iio.git.

Thanks,

Jonathan
> > ---
> > v2 -> v3: use NULL test instead of devm_ioremap_resource()
> > ---
> >   drivers/iio/adc/mxs-lradc-adc.c | 7 +++++--
> >   1 file changed, 5 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/iio/adc/mxs-lradc-adc.c b/drivers/iio/adc/mxs-lradc-adc.c
> > index b0c7d8e..6888167 100644
> > --- a/drivers/iio/adc/mxs-lradc-adc.c
> > +++ b/drivers/iio/adc/mxs-lradc-adc.c
> > @@ -718,9 +718,12 @@ 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 (IS_ERR(adc->base))
> > -		return PTR_ERR(adc->base);
> > +	if (!adc->base)
> > +		return -ENOMEM;
> >   
> >   	init_completion(&adc->completion);
> >   	spin_lock_init(&adc->lock);
> >   
> 
> --
> 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

--
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



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux