Andrew Lunn
321b4d4bd1
phy: marvell/micrel: Fix Unpossible condition
commit 2b2427d064 ("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: 2b2427d064 ("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-02-11 09:57:00 -05:00
2016-01-29 19:41:27 -08:00
2016-02-19 22:54:10 -05:00
2016-01-25 10:51:52 -08:00
2016-02-16 15:32:34 -05:00
2016-02-19 15:46:56 -05:00
2016-01-03 09:17:42 +01:00
2016-02-04 19:18:53 -05:00
2016-01-21 10:45:45 -08:00
2016-02-19 23:41:37 -05:00
2016-01-09 21:02:05 -05:00
2016-01-24 22:18:26 -08:00
2016-02-06 02:59:51 -05:00
2016-01-28 22:51:43 -08:00
2016-01-06 16:20:13 -05:00
2016-01-13 11:45:39 -05:00
2016-02-16 20:38:29 -05:00
2016-02-07 13:58:36 -05:00
2016-02-18 14:34:54 -05:00
2016-02-17 15:19:44 -05:00
2016-02-11 11:55:38 -05:00
2016-02-11 09:45:24 -05:00
2016-02-18 14:34:54 -05:00
2016-01-28 16:08:55 -08:00