diff options
author | Paul Bolle <pebolle@tiscali.nl> | 2012-11-02 19:53:15 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-11-03 15:43:04 -0400 |
commit | bb263e18f481199a04f7aab9454c18cd3dbdb218 (patch) | |
tree | d760742a35d1f0dd35f241e822ea16218690ed85 /drivers/net/ethernet/realtek/atp.c | |
parent | 5250c9694fa879532470d87ebf6a485be1124221 (diff) |
atp: remove set_rx_mode_8012()
Building atp.o triggers this GCC warning:
drivers/net/ethernet/realtek/atp.c: In function ‘set_rx_mode’:
drivers/net/ethernet/realtek/atp.c:871:26: warning: ‘mc_filter[0]’ may be used uninitialized in this function [-Wuninitialized]
GCC is correct. In promiscuous mode 'mc_filter' will be used
uninitialized in set_rx_mode_8012(), which is apparently inlined into
set_rx_mode().
But it turns out set_rx_mode_8012() will never be called, since
net_local.chip_type will always be RTL8002. So we can just remove
set_rx_mode_8012() and do some related cleanups.
Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/realtek/atp.c')
-rw-r--r-- | drivers/net/ethernet/realtek/atp.c | 58 |
1 files changed, 2 insertions, 56 deletions
diff --git a/drivers/net/ethernet/realtek/atp.c b/drivers/net/ethernet/realtek/atp.c index e02f04d7f3ad..9f2d416de750 100644 --- a/drivers/net/ethernet/realtek/atp.c +++ b/drivers/net/ethernet/realtek/atp.c | |||
@@ -175,8 +175,7 @@ struct net_local { | |||
175 | unsigned int tx_unit_busy:1; | 175 | unsigned int tx_unit_busy:1; |
176 | unsigned char re_tx, /* Number of packet retransmissions. */ | 176 | unsigned char re_tx, /* Number of packet retransmissions. */ |
177 | addr_mode, /* Current Rx filter e.g. promiscuous, etc. */ | 177 | addr_mode, /* Current Rx filter e.g. promiscuous, etc. */ |
178 | pac_cnt_in_tx_buf, | 178 | pac_cnt_in_tx_buf; |
179 | chip_type; | ||
180 | }; | 179 | }; |
181 | 180 | ||
182 | /* This code, written by wwc@super.org, resets the adapter every | 181 | /* This code, written by wwc@super.org, resets the adapter every |
@@ -339,7 +338,6 @@ static int __init atp_probe1(long ioaddr) | |||
339 | write_reg_high(ioaddr, CMR1, CMR1h_RESET | CMR1h_MUX); | 338 | write_reg_high(ioaddr, CMR1, CMR1h_RESET | CMR1h_MUX); |
340 | 339 | ||
341 | lp = netdev_priv(dev); | 340 | lp = netdev_priv(dev); |
342 | lp->chip_type = RTL8002; | ||
343 | lp->addr_mode = CMR2h_Normal; | 341 | lp->addr_mode = CMR2h_Normal; |
344 | spin_lock_init(&lp->lock); | 342 | spin_lock_init(&lp->lock); |
345 | 343 | ||
@@ -852,7 +850,7 @@ net_close(struct net_device *dev) | |||
852 | * Set or clear the multicast filter for this adapter. | 850 | * Set or clear the multicast filter for this adapter. |
853 | */ | 851 | */ |
854 | 852 | ||
855 | static void set_rx_mode_8002(struct net_device *dev) | 853 | static void set_rx_mode(struct net_device *dev) |
856 | { | 854 | { |
857 | struct net_local *lp = netdev_priv(dev); | 855 | struct net_local *lp = netdev_priv(dev); |
858 | long ioaddr = dev->base_addr; | 856 | long ioaddr = dev->base_addr; |
@@ -864,58 +862,6 @@ static void set_rx_mode_8002(struct net_device *dev) | |||
864 | write_reg_high(ioaddr, CMR2, lp->addr_mode); | 862 | write_reg_high(ioaddr, CMR2, lp->addr_mode); |
865 | } | 863 | } |
866 | 864 | ||
867 | static void set_rx_mode_8012(struct net_device *dev) | ||
868 | { | ||
869 | struct net_local *lp = netdev_priv(dev); | ||
870 | long ioaddr = dev->base_addr; | ||
871 | unsigned char new_mode, mc_filter[8]; /* Multicast hash filter */ | ||
872 | int i; | ||
873 | |||
874 | if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */ | ||
875 | new_mode = CMR2h_PROMISC; | ||
876 | } else if ((netdev_mc_count(dev) > 1000) || | ||
877 | (dev->flags & IFF_ALLMULTI)) { | ||
878 | /* Too many to filter perfectly -- accept all multicasts. */ | ||
879 | memset(mc_filter, 0xff, sizeof(mc_filter)); | ||
880 | new_mode = CMR2h_Normal; | ||
881 | } else { | ||
882 | struct netdev_hw_addr *ha; | ||
883 | |||
884 | memset(mc_filter, 0, sizeof(mc_filter)); | ||
885 | netdev_for_each_mc_addr(ha, dev) { | ||
886 | int filterbit = ether_crc_le(ETH_ALEN, ha->addr) & 0x3f; | ||
887 | mc_filter[filterbit >> 5] |= 1 << (filterbit & 31); | ||
888 | } | ||
889 | new_mode = CMR2h_Normal; | ||
890 | } | ||
891 | lp->addr_mode = new_mode; | ||
892 | write_reg(ioaddr, CMR2, CMR2_IRQOUT | 0x04); /* Switch to page 1. */ | ||
893 | for (i = 0; i < 8; i++) | ||
894 | write_reg_byte(ioaddr, i, mc_filter[i]); | ||
895 | if (net_debug > 2 || 1) { | ||
896 | lp->addr_mode = 1; | ||
897 | printk(KERN_DEBUG "%s: Mode %d, setting multicast filter to", | ||
898 | dev->name, lp->addr_mode); | ||
899 | for (i = 0; i < 8; i++) | ||
900 | printk(" %2.2x", mc_filter[i]); | ||
901 | printk(".\n"); | ||
902 | } | ||
903 | |||
904 | write_reg_high(ioaddr, CMR2, lp->addr_mode); | ||
905 | write_reg(ioaddr, CMR2, CMR2_IRQOUT); /* Switch back to page 0 */ | ||
906 | } | ||
907 | |||
908 | static void set_rx_mode(struct net_device *dev) | ||
909 | { | ||
910 | struct net_local *lp = netdev_priv(dev); | ||
911 | |||
912 | if (lp->chip_type == RTL8002) | ||
913 | return set_rx_mode_8002(dev); | ||
914 | else | ||
915 | return set_rx_mode_8012(dev); | ||
916 | } | ||
917 | |||
918 | |||
919 | static int __init atp_init_module(void) { | 865 | static int __init atp_init_module(void) { |
920 | if (debug) /* Emit version even if no cards detected. */ | 866 | if (debug) /* Emit version even if no cards detected. */ |
921 | printk(KERN_INFO "%s", version); | 867 | printk(KERN_INFO "%s", version); |