--- zzzz-none-000/linux-3.10.107/drivers/net/usb/catc.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/net/usb/catc.c 2021-02-04 17:41:59.000000000 +0000 @@ -24,15 +24,13 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * along with this program; if not, see . * * Should you need to contact me, the author, you can do so either by * e-mail - mail your message to , or by paper mail: * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic */ -#include #include #include #include @@ -640,10 +638,10 @@ { struct catc *catc = netdev_priv(netdev); struct netdev_hw_addr *ha; - u8 broadcast[6]; + u8 broadcast[ETH_ALEN]; u8 rx = RxEnable | RxPolarity | RxMultiCast; - memset(broadcast, 0xff, 6); + eth_broadcast_addr(broadcast); memset(catc->multicast, 0, 64); catc_multicast(broadcast, catc->multicast); @@ -778,8 +776,8 @@ struct usb_device *usbdev = interface_to_usbdev(intf); struct net_device *netdev; struct catc *catc; - u8 broadcast[6]; - int pktsz, ret; + u8 broadcast[ETH_ALEN]; + int i, pktsz; if (usb_set_interface(usbdev, intf->altsetting->desc.bInterfaceNumber, 1)) { @@ -795,7 +793,7 @@ netdev->netdev_ops = &catc_netdev_ops; netdev->watchdog_timeo = TX_TIMEOUT; - SET_ETHTOOL_OPS(netdev, &ops); + netdev->ethtool_ops = &ops; catc->usbdev = usbdev; catc->netdev = netdev; @@ -814,8 +812,12 @@ if ((!catc->ctrl_urb) || (!catc->tx_urb) || (!catc->rx_urb) || (!catc->irq_urb)) { dev_err(&intf->dev, "No free urbs available.\n"); - ret = -ENOMEM; - goto fail_free; + usb_free_urb(catc->ctrl_urb); + usb_free_urb(catc->tx_urb); + usb_free_urb(catc->rx_urb); + usb_free_urb(catc->irq_urb); + free_netdev(netdev); + return -ENOMEM; } /* The F5U011 has the same vendor/product as the netmate but a device version of 0x130 */ @@ -843,24 +845,15 @@ catc->irq_buf, 2, catc_irq_done, catc, 1); if (!catc->is_f5u011) { - u32 *buf; - int i; - dev_dbg(dev, "Checking memory size\n"); - buf = kmalloc(4, GFP_KERNEL); - if (!buf) { - ret = -ENOMEM; - goto fail_free; - } - - *buf = 0x12345678; - catc_write_mem(catc, 0x7a80, buf, 4); - *buf = 0x87654321; - catc_write_mem(catc, 0xfa80, buf, 4); - catc_read_mem(catc, 0x7a80, buf, 4); + i = 0x12345678; + catc_write_mem(catc, 0x7a80, &i, 4); + i = 0x87654321; + catc_write_mem(catc, 0xfa80, &i, 4); + catc_read_mem(catc, 0x7a80, &i, 4); - switch (*buf) { + switch (i) { case 0x12345678: catc_set_reg(catc, TxBufCount, 8); catc_set_reg(catc, RxBufCount, 32); @@ -875,8 +868,6 @@ dev_dbg(dev, "32k Memory\n"); break; } - - kfree(buf); dev_dbg(dev, "Getting MAC from SEEROM.\n"); @@ -889,7 +880,7 @@ dev_dbg(dev, "Filling the multicast list.\n"); - memset(broadcast, 0xff, 6); + eth_broadcast_addr(broadcast); catc_multicast(broadcast, catc->multicast); catc_multicast(netdev->dev_addr, catc->multicast); catc_write_mem(catc, 0xfa80, catc->multicast, 64); @@ -923,21 +914,16 @@ usb_set_intfdata(intf, catc); SET_NETDEV_DEV(netdev, &intf->dev); - ret = register_netdev(netdev); - if (ret) - goto fail_clear_intfdata; - + if (register_netdev(netdev) != 0) { + usb_set_intfdata(intf, NULL); + usb_free_urb(catc->ctrl_urb); + usb_free_urb(catc->tx_urb); + usb_free_urb(catc->rx_urb); + usb_free_urb(catc->irq_urb); + free_netdev(netdev); + return -EIO; + } return 0; - -fail_clear_intfdata: - usb_set_intfdata(intf, NULL); -fail_free: - usb_free_urb(catc->ctrl_urb); - usb_free_urb(catc->tx_urb); - usb_free_urb(catc->rx_urb); - usb_free_urb(catc->irq_urb); - free_netdev(netdev); - return ret; } static void catc_disconnect(struct usb_interface *intf)