Re: Help with dma on PCI driver

From: Jonathan Corbet
Date: Wed Mar 30 2011 - 11:23:14 EST


On Wed, 30 Mar 2011 07:07:32 -0300
Luis Filipe Rossi <luisf.rossi@xxxxxxxxx> wrote:

> I am developing a driver for a custom PCI board. I am following the
> example on Essential Linux Device Drivers, but when i am calling the
> pci_alloc_consitent i get the following error:
> Mar 29 15:18:42 luis-desktop kernel: [ 4520.075823] BUG: unable to
> handle kernel NULL pointer dereference at 00000004

Your source was horribly mangled, which is likely to reduce the number of
responses you get. I've not had the time to look at it in great detail,
but I will say that the assumption that the PCI device is already probed
and registered immediately after the pci_register_driver() call is
dangerous at best. Things like dma_descriptor_setup() should be called in
your probe routine (or even later, when you actually need the buffer)
rather than in your module init function.

There's a lot of other issues with this driver, but that's the one I would
look first at for the resolution of this particular crash.

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