<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">ChangeSet 1.1757.66.17, 2004/07/14 14:51:11-07:00, dhollis@davehollis.com

[PATCH] USB: ax8817x_unbind does not free the interrupt URB after unlinking

ax8817x_unbind does not free the interrupt URB after unlinking.

Noticed that the net-&gt;status already has a flag for link so my
private structure variable for link was redundant.  Worked around
this and was able to kill off the unique ax8817x_get_link() function
in the process.

Signed-off-by: David Hollis &lt;dhollis@davehollis.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;greg@kroah.com&gt;


 drivers/usb/net/usbnet.c |   26 +++++++++-----------------
 1 files changed, 9 insertions(+), 17 deletions(-)


diff -Nru a/drivers/usb/net/usbnet.c b/drivers/usb/net/usbnet.c
--- a/drivers/usb/net/usbnet.c	2004-07-14 16:44:53 -07:00
+++ b/drivers/usb/net/usbnet.c	2004-07-14 16:44:53 -07:00
@@ -461,7 +461,6 @@
 	u8 multi_filter[AX_MCAST_FILTER_SIZE];
 	struct urb *int_urb;
 	u8 *int_buf;
-	u8 link;
 };
 
 static int ax8817x_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
@@ -510,20 +509,20 @@
 {
 	struct usbnet *dev = (struct usbnet *)urb-&gt;context;
 	struct ax8817x_data *data = (struct ax8817x_data *)&amp;dev-&gt;data;
+	int link;
 
 	if (urb-&gt;status &lt; 0) {
 		printk(KERN_DEBUG "ax8817x_interrupt_complete() failed with %d",
 			urb-&gt;status);
 	} else {
 		if (data-&gt;int_buf[5] == 0x90) {
-			if (data-&gt;link != (data-&gt;int_buf[2] &amp; 0x01)) {
-				if (data-&gt;link == 1)
-					netif_carrier_off(dev-&gt;net);
-				else
+			link = data-&gt;int_buf[2] &amp; 0x01;
+			if (netif_carrier_ok(dev-&gt;net) != link) {
+				if (link)
 					netif_carrier_on(dev-&gt;net);
-
-				data-&gt;link = data-&gt;int_buf[2] &amp; 0x01;
-				devdbg(dev, "ax8817x: link is now %d", data-&gt;link);
+				else
+					netif_carrier_off(dev-&gt;net);
+				devdbg(dev, "ax8817x - Link Status is: %d", link);
 			}
 		}
 		usb_submit_urb(data-&gt;int_urb, GFP_KERNEL);
@@ -703,14 +702,6 @@
 	info-&gt;eedump_len = 0x3e;
 }
 
-static u32 ax8817x_get_link (struct net_device *net)
-{
-	struct usbnet *dev = (struct usbnet *)net-&gt;priv;
-	struct ax8817x_data *data = (struct ax8817x_data *)&amp;dev-&gt;data;
-
-	return (u32)data-&gt;link;
-}
-
 static int ax8817x_get_settings(struct net_device *net, struct ethtool_cmd *cmd)
 {
 	struct usbnet *dev = (struct usbnet *)net-&gt;priv;
@@ -730,7 +721,7 @@
    devices that may be connected at the same time. */
 static struct ethtool_ops ax8817x_ethtool_ops = {
 	.get_drvinfo		= ax8817x_get_drvinfo,
-	.get_link		= ax8817x_get_link,
+	.get_link		= ethtool_op_get_link,
 	.get_msglevel		= usbnet_get_msglevel,
 	.set_msglevel		= usbnet_set_msglevel,
 	.get_wol		= ax8817x_get_wol,
@@ -835,6 +826,7 @@
 	struct ax8817x_data *data = (struct ax8817x_data *)dev-&gt;data;
 
 	usb_unlink_urb(data-&gt;int_urb);
+	usb_free_urb(data-&gt;int_urb);
 	kfree(data-&gt;int_buf);
 }
 
</pre></body></html>