From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Ferre Subject: Re: [PATCH -next] spi: atmel: fix return value check in atmel_spi_probe() Date: Tue, 22 Oct 2013 16:03:39 +0100 Message-ID: <526693CB.2060408@atmel.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Cc: , To: Wei Yongjun , , , Return-path: In-Reply-To: Sender: linux-spi-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: On 21/10/2013 04:12, Wei Yongjun : > From: Wei Yongjun > > In case of error, the function devm_ioremap_resource() returns ERR_PTR() > and never returns NULL. Absolutely. > The NULL test in the return value check should be > replaced with IS_ERR(). > > Signed-off-by: Wei Yongjun Thanks for having spotted this: Acked-by: Nicolas Ferre > --- > drivers/spi/spi-atmel.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c > index 118a938..273db0b 100644 > --- a/drivers/spi/spi-atmel.c > +++ b/drivers/spi/spi-atmel.c > @@ -1547,8 +1547,10 @@ static int atmel_spi_probe(struct platform_device *pdev) > > as->pdev = pdev; > as->regs = devm_ioremap_resource(&pdev->dev, regs); > - if (!as->regs) > + if (IS_ERR(as->regs)) { > + ret = PTR_ERR(as->regs); > goto out_free_buffer; > + } > as->phybase = regs->start; > as->irq = irq; > as->clk = clk; > > -- Nicolas Ferre -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html