Messages in this thread Patch in this message | | | Subject | Re: dmaengine: BUG: Unable to handle kernel paging request | From | Dan Williams <> | Date | Mon, 12 Jan 2009 12:08:38 -0700 |
| |
On Mon, 2009-01-12 at 11:04 -0700, Ira Snyder wrote: > Hello all, > > I'm working on a driver that uses DMAEngine. With the recent changes, > the driver doesn't work anymore. > > I believe I have tracked it down to commit > 41d5e59c1299f27983977bcfe3b360600996051c, but it could be one of the > other DMAEngine commits. > > The code that crashes is in mm/dmapool.c, line 178: > if (list_empty(&dev->dma_pools)) > > I distilled the crash down to the following simple driver, which should > just get a reference to dmaengine, in preparation for acquiring a > channel to use.
I believe the problem is that the driver uses the channel device value before it is created. Prior to this patch the following line in fsl_dma_chan_probe:
new_fsl_chan->dev = &new_fsl_chan->common.dev
...would retrieve a pointer to the uninitialized struct device in dma_chan. The later call to dma_async_device_register in of_fsl_dma_probe fixed up this uninitialized data.
However, the dmaengine sysfs implementation was fixed to support proper lifetime rules which means that the current:
new_fsl_chan->dev = &new_fsl_chan->common.dev->device;
...retrieves a NULL pointer because new_fsl_chan->common.dev has not been allocated at this point.
The following may fix this up...
diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c index ca70a21..748e140 100644 --- a/drivers/dma/fsldma.c +++ b/drivers/dma/fsldma.c @@ -822,7 +822,7 @@ static int __devinit fsl_dma_chan_probe(struct fsl_dma_device *fdev, */ WARN_ON(fdev->feature != new_fsl_chan->feature); - new_fsl_chan->dev = &new_fsl_chan->common.dev->device; + new_fsl_chan->dev = fdev->dev; new_fsl_chan->reg_base = ioremap(new_fsl_chan->reg.start, new_fsl_chan->reg.end - new_fsl_chan->reg.start + 1);
| |