tulip: cleanup by using ARRAY_SIZE()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 23 Jan 2014 08:26:37 +0000 (11:26 +0300)
committerDavid S. Miller <davem@davemloft.net>
Thu, 23 Jan 2014 21:28:29 +0000 (13:28 -0800)
In this situation then ARRAY_SIZE() and sizeof() are the same, but we're
really dealing with array indexes and not byte offsets so ARRAY_SIZE()
is cleaner.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Grant Grundler <grundler@parisc-linux.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/dec/tulip/media.c

index 0d0ba725341aa15d2a290570c19a58bfeb354ee7..dcf21a36a9cf4864adb5fa8ab284f96d65265a68 100644 (file)
@@ -457,7 +457,7 @@ void tulip_find_mii(struct net_device *dev, int board_idx)
        /* Find the connected MII xcvrs.
           Doing this in open() would allow detecting external xcvrs later,
           but takes much time. */
-       for (phyn = 1; phyn <= 32 && phy_idx < sizeof (tp->phys); phyn++) {
+       for (phyn = 1; phyn <= 32 && phy_idx < ARRAY_SIZE(tp->phys); phyn++) {
                int phy = phyn & 0x1f;
                int mii_status = tulip_mdio_read (dev, phy, MII_BMSR);
                if ((mii_status & 0x8301) == 0x8001 ||