From: zhong jiang Date: Fri, 3 Aug 2018 06:53:14 +0000 (+0800) Subject: net:usb: Use ARRAY_SIZE instead of calculating the array size X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=bf37afceaf549ce9ef50e3042f64d257a3d4be80;p=openwrt%2Fstaging%2Fblogic.git net:usb: Use ARRAY_SIZE instead of calculating the array size We use ARRAY_SIZE to replace open code sizeof(lan78xx_regs) / sizeof(u32). It make the code concise. Signed-off-by: zhong jiang Signed-off-by: David S. Miller --- diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c index 4662fa0381f9..a9991c5f4736 100644 --- a/drivers/net/usb/lan78xx.c +++ b/drivers/net/usb/lan78xx.c @@ -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)