Re: next-20081121:WARNING: at drivers/dma/dmaengine.c:665dma_async_device_unregister()

From: Stephen Hemminger
Date: Sat Nov 22 2008 - 02:44:19 EST


On Fri, 21 Nov 2008 17:53:44 -0700
Dan Williams <dan.j.williams@xxxxxxxxx> wrote:

> On Fri, 2008-11-21 at 03:40 -0700, Alexander Beregalov wrote:
> > Hi
> >
> > It occured during shutdown process:
> >
> > sd 0:2:0:0: [sda] Synchronizing SCSI cache
> > ioatdma 0000:00:08.0: Removing dma and dca services
> > ------------[ cut here ]------------
> > WARNING: at drivers/dma/dmaengine.c:665 dma_async_device_unregister+0x90/0xd0()
> > dma_async_device_unregister called while 1 clients hold a reference
> ...
> > WARNING: at drivers/base/core.c:122 device_release+0x66/0x68()
> > Device 'dma0chan0' does not have a release() function, it is broken and must be
> > fixed.
>
> The following fixes these up for me. Maciej, do these look alright?:
>
> commit 16f5de60e2406c0c879627177aecd7ef489c30e5
> Author: Dan Williams <dan.j.williams@xxxxxxxxx>
> Date: Fri Nov 21 17:48:55 2008 -0700
>
> dmaengine: add a release for dma class devices
>
> Resolves:
> WARNING: at drivers/base/core.c:122 device_release+0x4d/0x52()
> Device 'dma0chan0' does not have a release() function, it is broken and must be fixed.
>
> Reported-by: Alexander Beregalov <a.beregalov@xxxxxxxxx>
> Signed-off-by: Dan Williams <dan.j.williams@xxxxxxxxx>
>
> diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
> index 6fc6595..94dcc64 100644
> --- a/drivers/dma/dmaengine.c
> +++ b/drivers/dma/dmaengine.c
> @@ -103,9 +103,16 @@ static struct device_attribute dma_attrs[] = {
> __ATTR_NULL
> };
>
> +static void chan_dev_release(struct device *dev)
> +{
> + /* nothing to do */
> + do { } while (0);
> +}
> +
> static struct class dma_devclass = {
> .name = "dma",
> .dev_attrs = dma_attrs,
> + .dev_release = chan_dev_release,
> };

The warning is there for a reason. Device objects can live in sysfs even
after the module is removed. You just wallpapered over the problem..
--
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/