diff options
Diffstat (limited to 'drivers/net/r6040.c')
-rw-r--r-- | drivers/net/r6040.c | 195 |
1 files changed, 117 insertions, 78 deletions
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c index 142c381e1d73..0ffec4608441 100644 --- a/drivers/net/r6040.c +++ b/drivers/net/r6040.c | |||
@@ -49,8 +49,8 @@ | |||
49 | #include <asm/processor.h> | 49 | #include <asm/processor.h> |
50 | 50 | ||
51 | #define DRV_NAME "r6040" | 51 | #define DRV_NAME "r6040" |
52 | #define DRV_VERSION "0.26" | 52 | #define DRV_VERSION "0.27" |
53 | #define DRV_RELDATE "30May2010" | 53 | #define DRV_RELDATE "23Feb2011" |
54 | 54 | ||
55 | /* PHY CHIP Address */ | 55 | /* PHY CHIP Address */ |
56 | #define PHY1_ADDR 1 /* For MAC1 */ | 56 | #define PHY1_ADDR 1 /* For MAC1 */ |
@@ -69,6 +69,8 @@ | |||
69 | 69 | ||
70 | /* MAC registers */ | 70 | /* MAC registers */ |
71 | #define MCR0 0x00 /* Control register 0 */ | 71 | #define MCR0 0x00 /* Control register 0 */ |
72 | #define MCR0_PROMISC 0x0020 /* Promiscuous mode */ | ||
73 | #define MCR0_HASH_EN 0x0100 /* Enable multicast hash table function */ | ||
72 | #define MCR1 0x04 /* Control register 1 */ | 74 | #define MCR1 0x04 /* Control register 1 */ |
73 | #define MAC_RST 0x0001 /* Reset the MAC */ | 75 | #define MAC_RST 0x0001 /* Reset the MAC */ |
74 | #define MBCR 0x08 /* Bus control */ | 76 | #define MBCR 0x08 /* Bus control */ |
@@ -200,7 +202,7 @@ struct r6040_private { | |||
200 | int old_duplex; | 202 | int old_duplex; |
201 | }; | 203 | }; |
202 | 204 | ||
203 | static char version[] __devinitdata = KERN_INFO DRV_NAME | 205 | static char version[] __devinitdata = DRV_NAME |
204 | ": RDC R6040 NAPI net driver," | 206 | ": RDC R6040 NAPI net driver," |
205 | "version "DRV_VERSION " (" DRV_RELDATE ")"; | 207 | "version "DRV_VERSION " (" DRV_RELDATE ")"; |
206 | 208 | ||
@@ -224,7 +226,8 @@ static int r6040_phy_read(void __iomem *ioaddr, int phy_addr, int reg) | |||
224 | } | 226 | } |
225 | 227 | ||
226 | /* Write a word data from PHY Chip */ | 228 | /* Write a word data from PHY Chip */ |
227 | static void r6040_phy_write(void __iomem *ioaddr, int phy_addr, int reg, u16 val) | 229 | static void r6040_phy_write(void __iomem *ioaddr, |
230 | int phy_addr, int reg, u16 val) | ||
228 | { | 231 | { |
229 | int limit = 2048; | 232 | int limit = 2048; |
230 | u16 cmd; | 233 | u16 cmd; |
@@ -348,8 +351,8 @@ static int r6040_alloc_rxbufs(struct net_device *dev) | |||
348 | } | 351 | } |
349 | desc->skb_ptr = skb; | 352 | desc->skb_ptr = skb; |
350 | desc->buf = cpu_to_le32(pci_map_single(lp->pdev, | 353 | desc->buf = cpu_to_le32(pci_map_single(lp->pdev, |
351 | desc->skb_ptr->data, | 354 | desc->skb_ptr->data, |
352 | MAX_BUF_SIZE, PCI_DMA_FROMDEVICE)); | 355 | MAX_BUF_SIZE, PCI_DMA_FROMDEVICE)); |
353 | desc->status = DSC_OWNER_MAC; | 356 | desc->status = DSC_OWNER_MAC; |
354 | desc = desc->vndescp; | 357 | desc = desc->vndescp; |
355 | } while (desc != lp->rx_ring); | 358 | } while (desc != lp->rx_ring); |
@@ -491,12 +494,14 @@ static int r6040_close(struct net_device *dev) | |||
491 | 494 | ||
492 | /* Free Descriptor memory */ | 495 | /* Free Descriptor memory */ |
493 | if (lp->rx_ring) { | 496 | if (lp->rx_ring) { |
494 | pci_free_consistent(pdev, RX_DESC_SIZE, lp->rx_ring, lp->rx_ring_dma); | 497 | pci_free_consistent(pdev, |
498 | RX_DESC_SIZE, lp->rx_ring, lp->rx_ring_dma); | ||
495 | lp->rx_ring = NULL; | 499 | lp->rx_ring = NULL; |
496 | } | 500 | } |
497 | 501 | ||
498 | if (lp->tx_ring) { | 502 | if (lp->tx_ring) { |
499 | pci_free_consistent(pdev, TX_DESC_SIZE, lp->tx_ring, lp->tx_ring_dma); | 503 | pci_free_consistent(pdev, |
504 | TX_DESC_SIZE, lp->tx_ring, lp->tx_ring_dma); | ||
500 | lp->tx_ring = NULL; | 505 | lp->tx_ring = NULL; |
501 | } | 506 | } |
502 | 507 | ||
@@ -530,7 +535,7 @@ static int r6040_rx(struct net_device *dev, int limit) | |||
530 | /* RX dribble */ | 535 | /* RX dribble */ |
531 | if (err & DSC_RX_ERR_DRI) | 536 | if (err & DSC_RX_ERR_DRI) |
532 | dev->stats.rx_frame_errors++; | 537 | dev->stats.rx_frame_errors++; |
533 | /* Buffer lenght exceeded */ | 538 | /* Buffer length exceeded */ |
534 | if (err & DSC_RX_ERR_BUF) | 539 | if (err & DSC_RX_ERR_BUF) |
535 | dev->stats.rx_length_errors++; | 540 | dev->stats.rx_length_errors++; |
536 | /* Packet too long */ | 541 | /* Packet too long */ |
@@ -547,7 +552,7 @@ static int r6040_rx(struct net_device *dev, int limit) | |||
547 | } | 552 | } |
548 | goto next_descr; | 553 | goto next_descr; |
549 | } | 554 | } |
550 | 555 | ||
551 | /* Packet successfully received */ | 556 | /* Packet successfully received */ |
552 | new_skb = netdev_alloc_skb(dev, MAX_BUF_SIZE); | 557 | new_skb = netdev_alloc_skb(dev, MAX_BUF_SIZE); |
553 | if (!new_skb) { | 558 | if (!new_skb) { |
@@ -556,13 +561,13 @@ static int r6040_rx(struct net_device *dev, int limit) | |||
556 | } | 561 | } |
557 | skb_ptr = descptr->skb_ptr; | 562 | skb_ptr = descptr->skb_ptr; |
558 | skb_ptr->dev = priv->dev; | 563 | skb_ptr->dev = priv->dev; |
559 | 564 | ||
560 | /* Do not count the CRC */ | 565 | /* Do not count the CRC */ |
561 | skb_put(skb_ptr, descptr->len - 4); | 566 | skb_put(skb_ptr, descptr->len - 4); |
562 | pci_unmap_single(priv->pdev, le32_to_cpu(descptr->buf), | 567 | pci_unmap_single(priv->pdev, le32_to_cpu(descptr->buf), |
563 | MAX_BUF_SIZE, PCI_DMA_FROMDEVICE); | 568 | MAX_BUF_SIZE, PCI_DMA_FROMDEVICE); |
564 | skb_ptr->protocol = eth_type_trans(skb_ptr, priv->dev); | 569 | skb_ptr->protocol = eth_type_trans(skb_ptr, priv->dev); |
565 | 570 | ||
566 | /* Send to upper layer */ | 571 | /* Send to upper layer */ |
567 | netif_receive_skb(skb_ptr); | 572 | netif_receive_skb(skb_ptr); |
568 | dev->stats.rx_packets++; | 573 | dev->stats.rx_packets++; |
@@ -672,9 +677,11 @@ static irqreturn_t r6040_interrupt(int irq, void *dev_id) | |||
672 | if (status & RX_FIFO_FULL) | 677 | if (status & RX_FIFO_FULL) |
673 | dev->stats.rx_fifo_errors++; | 678 | dev->stats.rx_fifo_errors++; |
674 | 679 | ||
675 | /* Mask off RX interrupt */ | 680 | if (likely(napi_schedule_prep(&lp->napi))) { |
676 | misr &= ~RX_INTS; | 681 | /* Mask off RX interrupt */ |
677 | napi_schedule(&lp->napi); | 682 | misr &= ~RX_INTS; |
683 | __napi_schedule(&lp->napi); | ||
684 | } | ||
678 | } | 685 | } |
679 | 686 | ||
680 | /* TX interrupt request */ | 687 | /* TX interrupt request */ |
@@ -710,8 +717,10 @@ static int r6040_up(struct net_device *dev) | |||
710 | return ret; | 717 | return ret; |
711 | 718 | ||
712 | /* improve performance (by RDC guys) */ | 719 | /* improve performance (by RDC guys) */ |
713 | r6040_phy_write(ioaddr, 30, 17, (r6040_phy_read(ioaddr, 30, 17) | 0x4000)); | 720 | r6040_phy_write(ioaddr, 30, 17, |
714 | r6040_phy_write(ioaddr, 30, 17, ~((~r6040_phy_read(ioaddr, 30, 17)) | 0x2000)); | 721 | (r6040_phy_read(ioaddr, 30, 17) | 0x4000)); |
722 | r6040_phy_write(ioaddr, 30, 17, | ||
723 | ~((~r6040_phy_read(ioaddr, 30, 17)) | 0x2000)); | ||
715 | r6040_phy_write(ioaddr, 0, 19, 0x0000); | 724 | r6040_phy_write(ioaddr, 0, 19, 0x0000); |
716 | r6040_phy_write(ioaddr, 0, 30, 0x01F0); | 725 | r6040_phy_write(ioaddr, 0, 30, 0x01F0); |
717 | 726 | ||
@@ -740,6 +749,9 @@ static void r6040_mac_address(struct net_device *dev) | |||
740 | iowrite16(adrp[0], ioaddr + MID_0L); | 749 | iowrite16(adrp[0], ioaddr + MID_0L); |
741 | iowrite16(adrp[1], ioaddr + MID_0M); | 750 | iowrite16(adrp[1], ioaddr + MID_0M); |
742 | iowrite16(adrp[2], ioaddr + MID_0H); | 751 | iowrite16(adrp[2], ioaddr + MID_0H); |
752 | |||
753 | /* Store MAC Address in perm_addr */ | ||
754 | memcpy(dev->perm_addr, dev->dev_addr, ETH_ALEN); | ||
743 | } | 755 | } |
744 | 756 | ||
745 | static int r6040_open(struct net_device *dev) | 757 | static int r6040_open(struct net_device *dev) |
@@ -751,7 +763,7 @@ static int r6040_open(struct net_device *dev) | |||
751 | ret = request_irq(dev->irq, r6040_interrupt, | 763 | ret = request_irq(dev->irq, r6040_interrupt, |
752 | IRQF_SHARED, dev->name, dev); | 764 | IRQF_SHARED, dev->name, dev); |
753 | if (ret) | 765 | if (ret) |
754 | return ret; | 766 | goto out; |
755 | 767 | ||
756 | /* Set MAC address */ | 768 | /* Set MAC address */ |
757 | r6040_mac_address(dev); | 769 | r6040_mac_address(dev); |
@@ -759,30 +771,37 @@ static int r6040_open(struct net_device *dev) | |||
759 | /* Allocate Descriptor memory */ | 771 | /* Allocate Descriptor memory */ |
760 | lp->rx_ring = | 772 | lp->rx_ring = |
761 | pci_alloc_consistent(lp->pdev, RX_DESC_SIZE, &lp->rx_ring_dma); | 773 | pci_alloc_consistent(lp->pdev, RX_DESC_SIZE, &lp->rx_ring_dma); |
762 | if (!lp->rx_ring) | 774 | if (!lp->rx_ring) { |
763 | return -ENOMEM; | 775 | ret = -ENOMEM; |
776 | goto err_free_irq; | ||
777 | } | ||
764 | 778 | ||
765 | lp->tx_ring = | 779 | lp->tx_ring = |
766 | pci_alloc_consistent(lp->pdev, TX_DESC_SIZE, &lp->tx_ring_dma); | 780 | pci_alloc_consistent(lp->pdev, TX_DESC_SIZE, &lp->tx_ring_dma); |
767 | if (!lp->tx_ring) { | 781 | if (!lp->tx_ring) { |
768 | pci_free_consistent(lp->pdev, RX_DESC_SIZE, lp->rx_ring, | 782 | ret = -ENOMEM; |
769 | lp->rx_ring_dma); | 783 | goto err_free_rx_ring; |
770 | return -ENOMEM; | ||
771 | } | 784 | } |
772 | 785 | ||
773 | ret = r6040_up(dev); | 786 | ret = r6040_up(dev); |
774 | if (ret) { | 787 | if (ret) |
775 | pci_free_consistent(lp->pdev, TX_DESC_SIZE, lp->tx_ring, | 788 | goto err_free_tx_ring; |
776 | lp->tx_ring_dma); | ||
777 | pci_free_consistent(lp->pdev, RX_DESC_SIZE, lp->rx_ring, | ||
778 | lp->rx_ring_dma); | ||
779 | return ret; | ||
780 | } | ||
781 | 789 | ||
782 | napi_enable(&lp->napi); | 790 | napi_enable(&lp->napi); |
783 | netif_start_queue(dev); | 791 | netif_start_queue(dev); |
784 | 792 | ||
785 | return 0; | 793 | return 0; |
794 | |||
795 | err_free_tx_ring: | ||
796 | pci_free_consistent(lp->pdev, TX_DESC_SIZE, lp->tx_ring, | ||
797 | lp->tx_ring_dma); | ||
798 | err_free_rx_ring: | ||
799 | pci_free_consistent(lp->pdev, RX_DESC_SIZE, lp->rx_ring, | ||
800 | lp->rx_ring_dma); | ||
801 | err_free_irq: | ||
802 | free_irq(dev->irq, dev); | ||
803 | out: | ||
804 | return ret; | ||
786 | } | 805 | } |
787 | 806 | ||
788 | static netdev_tx_t r6040_start_xmit(struct sk_buff *skb, | 807 | static netdev_tx_t r6040_start_xmit(struct sk_buff *skb, |
@@ -836,75 +855,92 @@ static void r6040_multicast_list(struct net_device *dev) | |||
836 | { | 855 | { |
837 | struct r6040_private *lp = netdev_priv(dev); | 856 | struct r6040_private *lp = netdev_priv(dev); |
838 | void __iomem *ioaddr = lp->base; | 857 | void __iomem *ioaddr = lp->base; |
839 | u16 *adrp; | ||
840 | u16 reg; | ||
841 | unsigned long flags; | 858 | unsigned long flags; |
842 | struct netdev_hw_addr *ha; | 859 | struct netdev_hw_addr *ha; |
843 | int i; | 860 | int i; |
861 | u16 *adrp; | ||
862 | u16 hash_table[4] = { 0 }; | ||
863 | |||
864 | spin_lock_irqsave(&lp->lock, flags); | ||
844 | 865 | ||
845 | /* MAC Address */ | 866 | /* Keep our MAC Address */ |
846 | adrp = (u16 *)dev->dev_addr; | 867 | adrp = (u16 *)dev->dev_addr; |
847 | iowrite16(adrp[0], ioaddr + MID_0L); | 868 | iowrite16(adrp[0], ioaddr + MID_0L); |
848 | iowrite16(adrp[1], ioaddr + MID_0M); | 869 | iowrite16(adrp[1], ioaddr + MID_0M); |
849 | iowrite16(adrp[2], ioaddr + MID_0H); | 870 | iowrite16(adrp[2], ioaddr + MID_0H); |
850 | 871 | ||
851 | /* Promiscous Mode */ | ||
852 | spin_lock_irqsave(&lp->lock, flags); | ||
853 | |||
854 | /* Clear AMCP & PROM bits */ | 872 | /* Clear AMCP & PROM bits */ |
855 | reg = ioread16(ioaddr) & ~0x0120; | 873 | lp->mcr0 = ioread16(ioaddr + MCR0) & ~(MCR0_PROMISC | MCR0_HASH_EN); |
856 | if (dev->flags & IFF_PROMISC) { | ||
857 | reg |= 0x0020; | ||
858 | lp->mcr0 |= 0x0020; | ||
859 | } | ||
860 | /* Too many multicast addresses | ||
861 | * accept all traffic */ | ||
862 | else if ((netdev_mc_count(dev) > MCAST_MAX) || | ||
863 | (dev->flags & IFF_ALLMULTI)) | ||
864 | reg |= 0x0020; | ||
865 | 874 | ||
866 | iowrite16(reg, ioaddr); | 875 | /* Promiscuous mode */ |
867 | spin_unlock_irqrestore(&lp->lock, flags); | 876 | if (dev->flags & IFF_PROMISC) |
877 | lp->mcr0 |= MCR0_PROMISC; | ||
868 | 878 | ||
869 | /* Build the hash table */ | 879 | /* Enable multicast hash table function to |
870 | if (netdev_mc_count(dev) > MCAST_MAX) { | 880 | * receive all multicast packets. */ |
871 | u16 hash_table[4]; | 881 | else if (dev->flags & IFF_ALLMULTI) { |
872 | u32 crc; | 882 | lp->mcr0 |= MCR0_HASH_EN; |
873 | 883 | ||
874 | for (i = 0; i < 4; i++) | 884 | for (i = 0; i < MCAST_MAX ; i++) { |
875 | hash_table[i] = 0; | 885 | iowrite16(0, ioaddr + MID_1L + 8 * i); |
886 | iowrite16(0, ioaddr + MID_1M + 8 * i); | ||
887 | iowrite16(0, ioaddr + MID_1H + 8 * i); | ||
888 | } | ||
876 | 889 | ||
890 | for (i = 0; i < 4; i++) | ||
891 | hash_table[i] = 0xffff; | ||
892 | } | ||
893 | /* Use internal multicast address registers if the number of | ||
894 | * multicast addresses is not greater than MCAST_MAX. */ | ||
895 | else if (netdev_mc_count(dev) <= MCAST_MAX) { | ||
896 | i = 0; | ||
877 | netdev_for_each_mc_addr(ha, dev) { | 897 | netdev_for_each_mc_addr(ha, dev) { |
878 | char *addrs = ha->addr; | 898 | u16 *adrp = (u16 *) ha->addr; |
899 | iowrite16(adrp[0], ioaddr + MID_1L + 8 * i); | ||
900 | iowrite16(adrp[1], ioaddr + MID_1M + 8 * i); | ||
901 | iowrite16(adrp[2], ioaddr + MID_1H + 8 * i); | ||
902 | i++; | ||
903 | } | ||
904 | while (i < MCAST_MAX) { | ||
905 | iowrite16(0, ioaddr + MID_1L + 8 * i); | ||
906 | iowrite16(0, ioaddr + MID_1M + 8 * i); | ||
907 | iowrite16(0, ioaddr + MID_1H + 8 * i); | ||
908 | i++; | ||
909 | } | ||
910 | } | ||
911 | /* Otherwise, Enable multicast hash table function. */ | ||
912 | else { | ||
913 | u32 crc; | ||
914 | |||
915 | lp->mcr0 |= MCR0_HASH_EN; | ||
879 | 916 | ||
880 | if (!(*addrs & 1)) | 917 | for (i = 0; i < MCAST_MAX ; i++) { |
881 | continue; | 918 | iowrite16(0, ioaddr + MID_1L + 8 * i); |
919 | iowrite16(0, ioaddr + MID_1M + 8 * i); | ||
920 | iowrite16(0, ioaddr + MID_1H + 8 * i); | ||
921 | } | ||
922 | |||
923 | /* Build multicast hash table */ | ||
924 | netdev_for_each_mc_addr(ha, dev) { | ||
925 | u8 *addrs = ha->addr; | ||
882 | 926 | ||
883 | crc = ether_crc_le(6, addrs); | 927 | crc = ether_crc(ETH_ALEN, addrs); |
884 | crc >>= 26; | 928 | crc >>= 26; |
885 | hash_table[crc >> 4] |= 1 << (15 - (crc & 0xf)); | 929 | hash_table[crc >> 4] |= 1 << (crc & 0xf); |
886 | } | 930 | } |
887 | /* Fill the MAC hash tables with their values */ | 931 | } |
932 | |||
933 | iowrite16(lp->mcr0, ioaddr + MCR0); | ||
934 | |||
935 | /* Fill the MAC hash tables with their values */ | ||
936 | if (lp->mcr0 && MCR0_HASH_EN) { | ||
888 | iowrite16(hash_table[0], ioaddr + MAR0); | 937 | iowrite16(hash_table[0], ioaddr + MAR0); |
889 | iowrite16(hash_table[1], ioaddr + MAR1); | 938 | iowrite16(hash_table[1], ioaddr + MAR1); |
890 | iowrite16(hash_table[2], ioaddr + MAR2); | 939 | iowrite16(hash_table[2], ioaddr + MAR2); |
891 | iowrite16(hash_table[3], ioaddr + MAR3); | 940 | iowrite16(hash_table[3], ioaddr + MAR3); |
892 | } | 941 | } |
893 | /* Multicast Address 1~4 case */ | 942 | |
894 | i = 0; | 943 | spin_unlock_irqrestore(&lp->lock, flags); |
895 | netdev_for_each_mc_addr(ha, dev) { | ||
896 | if (i < MCAST_MAX) { | ||
897 | adrp = (u16 *) ha->addr; | ||
898 | iowrite16(adrp[0], ioaddr + MID_1L + 8 * i); | ||
899 | iowrite16(adrp[1], ioaddr + MID_1M + 8 * i); | ||
900 | iowrite16(adrp[2], ioaddr + MID_1H + 8 * i); | ||
901 | } else { | ||
902 | iowrite16(0xffff, ioaddr + MID_1L + 8 * i); | ||
903 | iowrite16(0xffff, ioaddr + MID_1M + 8 * i); | ||
904 | iowrite16(0xffff, ioaddr + MID_1H + 8 * i); | ||
905 | } | ||
906 | i++; | ||
907 | } | ||
908 | } | 944 | } |
909 | 945 | ||
910 | static void netdev_get_drvinfo(struct net_device *dev, | 946 | static void netdev_get_drvinfo(struct net_device *dev, |
@@ -946,7 +982,7 @@ static const struct net_device_ops r6040_netdev_ops = { | |||
946 | .ndo_set_multicast_list = r6040_multicast_list, | 982 | .ndo_set_multicast_list = r6040_multicast_list, |
947 | .ndo_change_mtu = eth_change_mtu, | 983 | .ndo_change_mtu = eth_change_mtu, |
948 | .ndo_validate_addr = eth_validate_addr, | 984 | .ndo_validate_addr = eth_validate_addr, |
949 | .ndo_set_mac_address = eth_mac_addr, | 985 | .ndo_set_mac_address = eth_mac_addr, |
950 | .ndo_do_ioctl = r6040_ioctl, | 986 | .ndo_do_ioctl = r6040_ioctl, |
951 | .ndo_tx_timeout = r6040_tx_timeout, | 987 | .ndo_tx_timeout = r6040_tx_timeout, |
952 | #ifdef CONFIG_NET_POLL_CONTROLLER | 988 | #ifdef CONFIG_NET_POLL_CONTROLLER |
@@ -1039,7 +1075,7 @@ static int __devinit r6040_init_one(struct pci_dev *pdev, | |||
1039 | u16 *adrp; | 1075 | u16 *adrp; |
1040 | int i; | 1076 | int i; |
1041 | 1077 | ||
1042 | printk("%s\n", version); | 1078 | pr_info("%s\n", version); |
1043 | 1079 | ||
1044 | err = pci_enable_device(pdev); | 1080 | err = pci_enable_device(pdev); |
1045 | if (err) | 1081 | if (err) |
@@ -1113,7 +1149,8 @@ static int __devinit r6040_init_one(struct pci_dev *pdev, | |||
1113 | /* Some bootloader/BIOSes do not initialize | 1149 | /* Some bootloader/BIOSes do not initialize |
1114 | * MAC address, warn about that */ | 1150 | * MAC address, warn about that */ |
1115 | if (!(adrp[0] || adrp[1] || adrp[2])) { | 1151 | if (!(adrp[0] || adrp[1] || adrp[2])) { |
1116 | netdev_warn(dev, "MAC address not initialized, generating random\n"); | 1152 | netdev_warn(dev, "MAC address not initialized, " |
1153 | "generating random\n"); | ||
1117 | random_ether_addr(dev->dev_addr); | 1154 | random_ether_addr(dev->dev_addr); |
1118 | } | 1155 | } |
1119 | 1156 | ||
@@ -1135,6 +1172,7 @@ static int __devinit r6040_init_one(struct pci_dev *pdev, | |||
1135 | lp->mii_bus = mdiobus_alloc(); | 1172 | lp->mii_bus = mdiobus_alloc(); |
1136 | if (!lp->mii_bus) { | 1173 | if (!lp->mii_bus) { |
1137 | dev_err(&pdev->dev, "mdiobus_alloc() failed\n"); | 1174 | dev_err(&pdev->dev, "mdiobus_alloc() failed\n"); |
1175 | err = -ENOMEM; | ||
1138 | goto err_out_unmap; | 1176 | goto err_out_unmap; |
1139 | } | 1177 | } |
1140 | 1178 | ||
@@ -1147,6 +1185,7 @@ static int __devinit r6040_init_one(struct pci_dev *pdev, | |||
1147 | lp->mii_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL); | 1185 | lp->mii_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL); |
1148 | if (!lp->mii_bus->irq) { | 1186 | if (!lp->mii_bus->irq) { |
1149 | dev_err(&pdev->dev, "mii_bus irq allocation failed\n"); | 1187 | dev_err(&pdev->dev, "mii_bus irq allocation failed\n"); |
1188 | err = -ENOMEM; | ||
1150 | goto err_out_mdio; | 1189 | goto err_out_mdio; |
1151 | } | 1190 | } |
1152 | 1191 | ||