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-29 21:44:53 +01:00
2016-01-11 19:33:59 -08:00
2015-12-29 15:32:24 -05:00
2016-01-31 16:55:04 -08:00
2016-02-16 20:38:29 -05:00
2016-01-24 12:34:13 -08:00
2016-01-06 16:37:14 +01:00
2016-01-20 18:42:30 -08:00
2016-01-06 08:25:24 -05:00
2016-01-26 22:27:34 +08:00
2016-01-20 18:16:29 -08:00
2016-01-31 15:49:06 -08:00
2016-01-04 21:46:45 -05:00
2016-01-29 21:45:17 +01:00
2016-01-29 21:45:17 +01:00
2016-01-30 22:05:17 +08:00
2016-01-13 17:30:33 +09:00
2016-01-20 10:15:21 -08:00
2016-01-01 18:31:34 +01:00
2016-01-20 17:09:18 -08:00
2016-01-20 18:03:56 -08:00
2016-01-29 10:04:29 +10:00
2016-01-20 17:30:20 -08:00
2016-01-07 16:07:54 +01:00
2016-01-13 10:23:36 -08:00
2016-01-27 18:48:46 -08:00
2016-01-29 11:13:52 +01:00
2016-01-18 14:12:33 -05:00
2016-01-31 17:00:27 -08:00
2016-02-17 16:15:45 -05:00
2016-01-22 17:20:30 -08:00
2016-01-29 12:30:47 +01:00
2016-01-31 14:48:58 -08:00
2016-02-18 11:09:30 -05:00
2016-01-17 12:32:01 -08:00
2016-01-12 12:17:28 +01:00
2016-01-12 08:21:18 -07:00
2016-01-21 18:19:38 -08:00
2016-01-20 17:09:18 -08:00
2016-01-20 18:42:30 -08:00
2016-01-20 17:09:18 -08:00
2016-01-17 12:32:01 -08:00
2016-01-21 12:32:08 -08:00
2016-01-22 12:04:21 -08:00
2016-01-24 12:50:56 -08:00
2016-02-19 23:41:37 -05:00
2015-12-29 19:06:23 +01:00
2016-01-21 19:53:10 -05:00
2016-01-29 17:43:16 -08:00
2016-01-21 19:58:02 -08:00
2016-02-01 15:56:08 -08:00
2016-01-22 18:04:28 -05:00
2016-01-20 17:09:18 -08:00
2016-01-03 16:32:59 -08:00
2016-01-29 21:44:53 +01:00
2016-01-17 12:32:01 -08:00
2016-01-24 10:15:01 -08:00
2016-01-04 22:12:42 +01:00
2016-01-14 01:03:18 +01:00
2016-01-12 01:12:40 +01:00
2016-01-29 12:38:59 -08:00
2016-01-21 15:04:59 +01:00
2016-01-20 17:09:18 -08:00
2016-01-15 12:14:47 -08:00
2016-01-12 20:47:06 +02:00
2016-01-12 20:47:06 +02:00
2016-01-18 12:10:45 -08:00
2016-01-26 12:47:51 +01:00
2016-01-04 10:26:58 -05:00
2016-01-26 17:44:42 -08:00
2016-01-22 17:30:52 -08:00
2016-01-15 13:18:47 -08:00
2016-01-19 21:25:57 +02:00
2016-01-31 17:09:39 -08:00
2016-01-21 19:58:02 -08:00
2016-01-24 12:43:06 -08:00
2016-01-31 17:09:39 -08:00
2016-01-28 08:32:42 -08:00
2016-01-27 11:22:25 -07:00
2016-01-22 18:04:28 -05:00
2016-01-26 10:18:28 +02:00
2016-01-11 22:48:05 +01:00
2016-01-29 15:13:48 -08:00