Re: [PATCH 07/33] dma: Convert to devm_ioremap_resource()

From: Greg Kroah-Hartman
Date: Tue Jan 29 2013 - 08:20:25 EST


On Tue, Jan 29, 2013 at 03:11:05PM +0200, Andy Shevchenko wrote:
> On Mon, Jan 21, 2013 at 12:09 PM, Thierry Reding
> <thierry.reding@xxxxxxxxxxxxxxxxx> wrote:
> > Convert all uses of devm_request_and_ioremap() to the newly introduced
> > devm_ioremap_resource() which provides more consistent error handling.
> >
> > devm_ioremap_resource() provides its own error messages so all explicit
> > error messages can be removed from the failure code paths.
> >
> > Signed-off-by: Thierry Reding <thierry.reding@xxxxxxxxxxxxxxxxx>
> > Cc: Vinod Koul <vinod.koul@xxxxxxxxx>
> > ---
> > drivers/dma/dw_dmac.c | 7 ++++---
> > drivers/dma/imx-dma.c | 7 ++++---
> > drivers/dma/mmp_pdma.c | 7 ++++---
> > drivers/dma/mmp_tdma.c | 7 ++++---
> > drivers/dma/tegra20-apb-dma.c | 10 ++++------
> > 5 files changed, 20 insertions(+), 18 deletions(-)
> >
> > diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
> > index 3e8ba02..b33d1f6 100644
> > --- a/drivers/dma/dw_dmac.c
> > +++ b/drivers/dma/dw_dmac.c
> > @@ -14,6 +14,7 @@
> > #include <linux/delay.h>
> > #include <linux/dmaengine.h>
> > #include <linux/dma-mapping.h>
> > +#include <linux/err.h>
> > #include <linux/init.h>
> > #include <linux/interrupt.h>
> > #include <linux/io.h>
> > @@ -1489,9 +1490,9 @@ static int dw_probe(struct platform_device *pdev)
> > if (irq < 0)
> > return irq;
> >
> > - regs = devm_request_and_ioremap(&pdev->dev, io);
> > - if (!regs)
> > - return -EBUSY;
> > + regs = devm_ioremap_resource(&pdev->dev, io);
> > + if (IS_ERR(regs))
> > + return PTR_ERR(regs);
>
> Do you concern that change makes sparse crazy?
>
> drivers/dma/dw_dmac.c:1690:20: warning: incorrect type in argument 1
> (different address spaces)
> drivers/dma/dw_dmac.c:1690:20: expected void const *ptr
> drivers/dma/dw_dmac.c:1690:20: got void [noderef] <asn:2>*[assigned] regs
> drivers/dma/dw_dmac.c:1691:32: warning: incorrect type in argument 1
> (different address spaces)
> drivers/dma/dw_dmac.c:1691:32: expected void const *ptr
> drivers/dma/dw_dmac.c:1691:32: got void [noderef] <asn:2>*[assigned] regs

Yeah, Thierry has been emailing me about this and it's a false-positive
that I don't know how we are going to make sparse handle properly.

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/