Commit 4a9a678d authored by David T. Hollis's avatar David T. Hollis Committed by Greg Kroah-Hartman

[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->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: default avatarDavid Hollis <dhollis@davehollis.com>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 8e9305b2
...@@ -461,7 +461,6 @@ struct ax8817x_data { ...@@ -461,7 +461,6 @@ struct ax8817x_data {
u8 multi_filter[AX_MCAST_FILTER_SIZE]; u8 multi_filter[AX_MCAST_FILTER_SIZE];
struct urb *int_urb; struct urb *int_urb;
u8 *int_buf; u8 *int_buf;
u8 link;
}; };
static int ax8817x_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, static int ax8817x_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
...@@ -510,20 +509,20 @@ static void ax8817x_interrupt_complete(struct urb *urb, struct pt_regs *regs) ...@@ -510,20 +509,20 @@ static void ax8817x_interrupt_complete(struct urb *urb, struct pt_regs *regs)
{ {
struct usbnet *dev = (struct usbnet *)urb->context; struct usbnet *dev = (struct usbnet *)urb->context;
struct ax8817x_data *data = (struct ax8817x_data *)&dev->data; struct ax8817x_data *data = (struct ax8817x_data *)&dev->data;
int link;
if (urb->status < 0) { if (urb->status < 0) {
printk(KERN_DEBUG "ax8817x_interrupt_complete() failed with %d", printk(KERN_DEBUG "ax8817x_interrupt_complete() failed with %d",
urb->status); urb->status);
} else { } else {
if (data->int_buf[5] == 0x90) { if (data->int_buf[5] == 0x90) {
if (data->link != (data->int_buf[2] & 0x01)) { link = data->int_buf[2] & 0x01;
if (data->link == 1) if (netif_carrier_ok(dev->net) != link) {
netif_carrier_off(dev->net); if (link)
else
netif_carrier_on(dev->net); netif_carrier_on(dev->net);
else
data->link = data->int_buf[2] & 0x01; netif_carrier_off(dev->net);
devdbg(dev, "ax8817x: link is now %d", data->link); devdbg(dev, "ax8817x - Link Status is: %d", link);
} }
} }
usb_submit_urb(data->int_urb, GFP_KERNEL); usb_submit_urb(data->int_urb, GFP_KERNEL);
...@@ -703,14 +702,6 @@ static void ax8817x_get_drvinfo (struct net_device *net, ...@@ -703,14 +702,6 @@ static void ax8817x_get_drvinfo (struct net_device *net,
info->eedump_len = 0x3e; info->eedump_len = 0x3e;
} }
static u32 ax8817x_get_link (struct net_device *net)
{
struct usbnet *dev = (struct usbnet *)net->priv;
struct ax8817x_data *data = (struct ax8817x_data *)&dev->data;
return (u32)data->link;
}
static int ax8817x_get_settings(struct net_device *net, struct ethtool_cmd *cmd) static int ax8817x_get_settings(struct net_device *net, struct ethtool_cmd *cmd)
{ {
struct usbnet *dev = (struct usbnet *)net->priv; struct usbnet *dev = (struct usbnet *)net->priv;
...@@ -730,7 +721,7 @@ static int ax8817x_set_settings(struct net_device *net, struct ethtool_cmd *cmd) ...@@ -730,7 +721,7 @@ static int ax8817x_set_settings(struct net_device *net, struct ethtool_cmd *cmd)
devices that may be connected at the same time. */ devices that may be connected at the same time. */
static struct ethtool_ops ax8817x_ethtool_ops = { static struct ethtool_ops ax8817x_ethtool_ops = {
.get_drvinfo = ax8817x_get_drvinfo, .get_drvinfo = ax8817x_get_drvinfo,
.get_link = ax8817x_get_link, .get_link = ethtool_op_get_link,
.get_msglevel = usbnet_get_msglevel, .get_msglevel = usbnet_get_msglevel,
.set_msglevel = usbnet_set_msglevel, .set_msglevel = usbnet_set_msglevel,
.get_wol = ax8817x_get_wol, .get_wol = ax8817x_get_wol,
...@@ -835,6 +826,7 @@ static void ax8817x_unbind(struct usbnet *dev, struct usb_interface *intf) ...@@ -835,6 +826,7 @@ static void ax8817x_unbind(struct usbnet *dev, struct usb_interface *intf)
struct ax8817x_data *data = (struct ax8817x_data *)dev->data; struct ax8817x_data *data = (struct ax8817x_data *)dev->data;
usb_unlink_urb(data->int_urb); usb_unlink_urb(data->int_urb);
usb_free_urb(data->int_urb);
kfree(data->int_buf); kfree(data->int_buf);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment