Re: ehci : bug if there no dma buffer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Greg KH a écrit :
On Tue, Aug 03, 2010 at 06:34:39PM +0200, Matthieu CASTET wrote:
In some case, dev->dma_mask isn't set by ehci platform driver. This
can cause nasty bugs difficult to debug (for example setup_dma
mapped at 0).
Check it at init time.

Signed-off-by: Matthieu CASTET <matthieu.castet@xxxxxxxxxx>

diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index a3ef2a9..8b8067a 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -522,6 +522,8 @@ static int ehci_init(struct usb_hcd *hcd)
 	u32			hcc_params;
 	struct ehci_qh_hw	*hw;
+ /* we need dma buffer */
+	BUG_ON(hcd->self.uses_dma == 0 && (hcd->driver->flags & HCD_LOCAL_MEM) == 0);

So you want to panic the machine?

That's not nice, I'm not going to add new BUG_ON() to the kernel, sorry.

How about a warning instead?

Ok, here a new patch.

Note that this should happen only for people porting ehci to a new interface/soc, so they don't really care about panic.

---------
In some case, dev->dma_mask isn't set by ehci platform driver. This can
cause nasty bugs difficult to debug (for example setup_dma mapped at 0).
Check it at init time.

Signed-off-by: Matthieu CASTET <matthieu.castet@xxxxxxxxxx>
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index a3ef2a9..c04a4e1 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -522,6 +522,8 @@ static int ehci_init(struct usb_hcd *hcd)
 	u32			hcc_params;
 	struct ehci_qh_hw	*hw;
 
+	/* we need dma buffer */
+	WARN_ON(hcd->self.uses_dma == 0 && (hcd->driver->flags & HCD_LOCAL_MEM) == 0);
 	spin_lock_init(&ehci->lock);
 
 	/*

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux