On Mon, 24 Nov 2014, Sebastian Andrzej Siewior wrote:

> the following error pops up during "testusb -a -t 10"
> | musb-hdrc musb-hdrc.1.auto: dma_pool_free buffer-128,       
> f134e000/be842000 (bad dma)
> 
> hcd_buffer_create() creates a few buffers, the smallest has 32 bytes of
> size. ARCH_KMALLOC_MINALIGN is set to 64 bytes. This combo results in
> hcd_buffer_alloc() returning memory which is 32bytes aligned and it
> might by identified by buffer_offset() as another buffer. This means the
> buffer which is on a 32byte boundary will not get freed, instead it
> tries to free another buffer with the error message.
> 
> This patch fixes the issue by checking only if the lowest bit is set
> which is the only "unaligned" offset which is currently passed to
> usbtest_alloc_urb(). Another way of dealing with this would be to
> respect ARCH_KMALLOC_MINALIGN in hcd_buffer_create() and having the
> smallest buffer starting at 64 bytes in this case.

I think the second alternative would make more sense.  It's pointless 
to have DMA buffers that aren't aligned strictly enough.

Don't forget that other architectures can have other values for 
ARCH_KMALLOC_MINALIGN.  The code should work on all architectures.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to