Andrew Lunn
321b4d4bd1
phy: marvell/micrel: Fix Unpossible condition
commit 2b2427d06426 ("phy: micrel: Add ethtool statistics counters")
from Dec 30, 2015, leads to the following static checker
warning:
drivers/net/phy/micrel.c:609 kszphy_get_stat()
warn: unsigned 'val' is never less than zero.
drivers/net/phy/micrel.c
602 static u64 kszphy_get_stat(struct phy_device *phydev, int i)
603 {
604 struct kszphy_hw_stat stat = kszphy_hw_stats[i];
605 struct kszphy_priv *priv = phydev->priv;
606 u64 val;
607
608 val = phy_read(phydev, stat.reg);
609 if (val < 0) {
^^^^^^^
Unpossible!
610 val = UINT64_MAX;
611 } else {
612 val = val & ((1 << stat.bits) - 1);
613 priv->stats[i] += val;
614 val = priv->stats[i];
615 }
616
617 return val;
618 }
The same problem exists in the Marvell driver. Fix both.
Fixes: 2b2427d06426 ("phy: micrel: Add ethtool statistics counters")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reported-by: Julia.Lawall <julia.lawall@lip6.fr>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-02-19 23:41:37 -05:00
..
2016-01-07 14:31:27 -05:00
2016-01-07 14:31:27 -05:00
2016-01-17 19:16:47 -05:00
2016-02-16 14:57:30 -05:00
2016-01-07 14:31:27 -05:00
2016-01-07 14:31:27 -05:00
2015-10-08 04:45:52 -07:00
2016-01-07 14:31:25 -05:00
2016-01-07 14:31:27 -05:00
2016-01-07 14:31:27 -05:00
2016-01-07 14:31:27 -05:00
2016-01-20 18:54:08 -08:00
2016-02-18 15:53:10 -05:00
2016-01-07 14:31:27 -05:00
2016-01-07 14:31:27 -05:00
2016-01-07 14:31:26 -05:00
2016-01-07 14:31:27 -05:00
2016-01-28 16:03:19 -08:00
2016-01-07 14:31:27 -05:00
2016-01-07 14:31:27 -05:00
2016-02-19 23:41:37 -05:00
2016-01-12 11:49:20 -05:00
2016-01-07 14:31:27 -05:00
2016-01-07 14:31:26 -05:00
2016-01-07 14:31:26 -05:00
2016-01-07 14:31:26 -05:00
2015-10-26 22:08:12 -07:00
2016-01-07 14:31:26 -05:00
2016-01-07 14:31:26 -05:00
2016-01-07 14:31:26 -05:00
2016-02-19 23:41:37 -05:00
2016-01-07 14:31:27 -05:00
2016-01-07 14:31:27 -05:00
2016-01-15 14:49:11 -05:00
2016-01-21 10:48:51 -08:00
2016-01-07 14:31:27 -05:00
2016-01-07 14:31:27 -05:00
2016-01-21 12:06:03 -08:00
2016-02-16 20:37:04 -05:00
2016-01-07 14:31:27 -05:00
2016-01-07 14:31:27 -05:00
2016-01-07 14:31:27 -05:00