r8169,sis190: remove unnecessary length check
authorPeter Wu <lekensteyn@gmail.com>
Fri, 16 Aug 2013 23:07:53 +0000 (01:07 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 20 Aug 2013 21:57:42 +0000 (14:57 -0700)
The ethtool core will lower the requested length to the one returned by
get_regs_len, therefore no additional check is needed in the get_regs
function.

Reported-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: Peter Wu <lekensteyn@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/realtek/r8169.c
drivers/net/ethernet/sis/sis190.c

index b5eb4195fc9927a8b88493c7b1f783926928dc8c..93ee49d29317b56619dc007042ceb5379830ce7a 100644 (file)
@@ -1898,9 +1898,6 @@ static void rtl8169_get_regs(struct net_device *dev, struct ethtool_regs *regs,
 {
        struct rtl8169_private *tp = netdev_priv(dev);
 
-       if (regs->len > R8169_REGS_SIZE)
-               regs->len = R8169_REGS_SIZE;
-
        rtl_lock_work(tp);
        memcpy_fromio(p, tp->mmio_addr, regs->len);
        rtl_unlock_work(tp);
index 02df0894690d698c7234e8057a58714ad65a2915..ee18e6f7b4fe19d9b8e3bbec69fd5e2cd098cb81 100644 (file)
@@ -1770,9 +1770,6 @@ static void sis190_get_regs(struct net_device *dev, struct ethtool_regs *regs,
        struct sis190_private *tp = netdev_priv(dev);
        unsigned long flags;
 
-       if (regs->len > SIS190_REGS_SIZE)
-               regs->len = SIS190_REGS_SIZE;
-
        spin_lock_irqsave(&tp->lock, flags);
        memcpy_fromio(p, tp->mmio_addr, regs->len);
        spin_unlock_irqrestore(&tp->lock, flags);