ChangeSet 1.1119.1.6, 2003/08/06 15:51:17-07:00, oliver@neukum.org [PATCH] USB: DMA coherency issue with rtl8150 DMA to a part of a structure is forbidden on the noncoherent architectures. drivers/usb/net/rtl8150.c | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-) diff -Nru a/drivers/usb/net/rtl8150.c b/drivers/usb/net/rtl8150.c --- a/drivers/usb/net/rtl8150.c Fri Aug 8 17:05:50 2003 +++ b/drivers/usb/net/rtl8150.c Fri Aug 8 17:05:51 2003 @@ -51,6 +51,7 @@ #define PHY_GO 0x40 #define MII_TIMEOUT 10 +#define INTBUFSIZE 8 #define RTL8150_REQT_READ 0xc0 #define RTL8150_REQT_WRITE 0x40 @@ -98,7 +99,7 @@ struct usb_ctrlrequest dr; int intr_interval; u16 rx_creg; - u8 intr_buff[8]; + u8 *intr_buff; u8 phy; }; @@ -646,7 +647,7 @@ if ((res = usb_submit_urb(dev->rx_urb, GFP_KERNEL))) warn("%s: rx_urb submit failed: %d", __FUNCTION__, res); usb_fill_int_urb(dev->intr_urb, dev->udev, usb_rcvintpipe(dev->udev, 3), - dev->intr_buff, sizeof(dev->intr_buff), intr_callback, + dev->intr_buff, INTBUFSIZE, intr_callback, dev, dev->intr_interval); if ((res = usb_submit_urb(dev->intr_urb, GFP_KERNEL))) warn("%s: intr_urb submit failed: %d", __FUNCTION__, res); @@ -790,8 +791,15 @@ } else memset(dev, 0, sizeof(rtl8150_t)); + dev->intr_buff = kmalloc(INTBUFSIZE, GFP_KERNEL); + if (!dev->intr_buff) { + kfree(dev); + return -ENOMEM; + } + netdev = alloc_etherdev(0); if (!netdev) { + kfree(dev->intr_buff); kfree(dev); err("Oh boy, out of memory again?!?"); return -ENOMEM; @@ -843,6 +851,7 @@ out1: free_all_urbs(dev); out: + kfree(dev->intr_buff); kfree(netdev); kfree(dev); return -EIO; @@ -862,6 +871,7 @@ if (dev->rx_skb) dev_kfree_skb(dev->rx_skb); kfree(dev->netdev); + kfree(dev->intr_buff); kfree(dev); } }