net:usb: Use ARRAY_SIZE instead of calculating the array size
authorzhong jiang <zhongjiang@huawei.com>
Fri, 3 Aug 2018 06:53:14 +0000 (14:53 +0800)
committerDavid S. Miller <davem@davemloft.net>
Sat, 4 Aug 2018 20:23:15 +0000 (13:23 -0700)
We use ARRAY_SIZE to replace open code sizeof(lan78xx_regs) / sizeof(u32).
It make the code concise.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/usb/lan78xx.c

index 4662fa0381f98d6ebfe0606500f8c195ce0be770..a9991c5f4736b6dd1e395527fbfeeecc3d0ab303 100644 (file)
@@ -1649,7 +1649,7 @@ lan78xx_get_regs(struct net_device *netdev, struct ethtool_regs *regs,
        struct lan78xx_net *dev = netdev_priv(netdev);
 
        /* Read Device/MAC registers */
-       for (i = 0; i < (sizeof(lan78xx_regs) / sizeof(u32)); i++)
+       for (i = 0; i < ARRAY_SIZE(lan78xx_regs); i++)
                lan78xx_read_reg(dev, lan78xx_regs[i], &data[i]);
 
        if (!netdev->phydev)