Commit fd477858 authored by Daniil Tatianin's avatar Daniil Tatianin Committed by David S. Miller
Browse files

net/ethtool/ioctl: remove if n_stats checks from ethtool_get_phy_stats



Now that we always early return if we don't have any stats we can remove
these checks as they're no longer necessary.

Signed-off-by: default avatarDaniil Tatianin <d-tatianin@yandex-team.ru>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9deb1e9f
Loading
Loading
Loading
Loading
+10 −14
Original line number Diff line number Diff line
@@ -2107,7 +2107,6 @@ static int ethtool_get_phy_stats(struct net_device *dev, void __user *useraddr)

	stats.n_stats = n_stats;

	if (n_stats) {
	data = vzalloc(array_size(n_stats, sizeof(u64)));
	if (!data)
		return -ENOMEM;
@@ -2120,15 +2119,12 @@ static int ethtool_get_phy_stats(struct net_device *dev, void __user *useraddr)
	} else {
		ops->get_ethtool_phy_stats(dev, &stats, data);
	}
	} else {
		data = NULL;
	}

	ret = -EFAULT;
	if (copy_to_user(useraddr, &stats, sizeof(stats)))
		goto out;
	useraddr += sizeof(stats);
	if (n_stats && copy_to_user(useraddr, data, array_size(n_stats, sizeof(u64))))
	if (copy_to_user(useraddr, data, array_size(n_stats, sizeof(u64))))
		goto out;
	ret = 0;