--- a/drivers/usb/net/usbnet.c 2003-09-18 23:33:11.079001376 -0400
+++ b/drivers/usb/net/usbnet.c 2003-09-18 23:41:39.314737800 -0400
@@ -455,11 +455,11 @@
static void ax8817x_async_cmd_callback(struct urb *urb, struct pt_regs *regs)
{
struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)urb->context;
-
+
if (urb->status < 0)
printk(KERN_DEBUG "ax8817x_async_cmd_callback() failed with %d",
urb->status);
-
+
kfree(req);
usb_free_urb(urb);
}
@@ -470,12 +470,12 @@
struct usb_ctrlrequest *req;
int status;
struct urb *urb;
-
+
if ((urb = usb_alloc_urb(0, GFP_ATOMIC)) == NULL) {
devdbg(dev, "Error allocating URB in write_cmd_async!");
return;
}
-
+
if ((req = kmalloc(sizeof(struct usb_ctrlrequest), GFP_ATOMIC)) == NULL) {
deverr(dev, "Failed to allocate memory for control request");
usb_free_urb(urb);
@@ -510,34 +510,31 @@
} else if (net->mc_count == 0) {
/* just broadcast and directed */
} else {
+ /* We use the 20 byte dev->data
+ * for our 8 byte filter buffer
+ * to avoid allocating memory that
+ * is tricky to free later */
+ u8 *multi_filter = (u8 *)dev->data;
struct dev_mc_list *mc_list = net->mc_list;
- u8 *multi_filter;
u32 crc_bits;
int i;
- multi_filter = kmalloc(AX_MCAST_FILTER_SIZE, GFP_ATOMIC);
- if (multi_filter == NULL) {
- /* Oops, couldn't allocate a buffer for setting the multicast
- filter. Try all multi mode. */
- rx_ctl |= 0x02;
- } else {
- memset(multi_filter, 0, AX_MCAST_FILTER_SIZE);
-
- /* Build the multicast hash filter. */
- for (i = 0; i < net->mc_count; i++) {
- crc_bits =
- ether_crc(ETH_ALEN,
- mc_list->dmi_addr) >> 26;
- multi_filter[crc_bits >> 3] |=
- 1 << (crc_bits & 7);
- mc_list = mc_list->next;
- }
-
- ax8817x_write_cmd_async(dev, AX_CMD_WRITE_MULTI_FILTER, 0, 0,
- AX_MCAST_FILTER_SIZE, multi_filter);
+ memset(multi_filter, 0, AX_MCAST_FILTER_SIZE);
- rx_ctl |= 0x10;
+ /* Build the multicast hash filter. */
+ for (i = 0; i < net->mc_count; i++) {
+ crc_bits =
+ ether_crc(ETH_ALEN,
+ mc_list->dmi_addr) >> 26;
+ multi_filter[crc_bits >> 3] |=
+ 1 << (crc_bits & 7);
+ mc_list = mc_list->next;
}
+
+ ax8817x_write_cmd_async(dev, AX_CMD_WRITE_MULTI_FILTER, 0, 0,
+ AX_MCAST_FILTER_SIZE, multi_filter);
+
+ rx_ctl |= 0x10;
}
ax8817x_write_cmd_async(dev, AX_CMD_WRITE_RX_CTL, rx_ctl, 0, 0, NULL);
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel