diff options
| author | Andrew Lunn <[email protected]> | 2016-02-19 23:35:29 +0000 |
|---|---|---|
| committer | David S. Miller <[email protected]> | 2016-02-20 04:41:37 +0000 |
| commit | 321b4d4bd12f90e7497c9ab057aafcc2649aa902 (patch) | |
| tree | 303d777fcba3f7aedecce0b5d3c059f2997e9229 /net/unix/af_unix.c | |
| parent | Merge branch 'ethtool-perqueue-params' (diff) | |
| download | kernel-321b4d4bd12f90e7497c9ab057aafcc2649aa902.tar.gz kernel-321b4d4bd12f90e7497c9ab057aafcc2649aa902.zip | |
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 <[email protected]>
Reported-by: Julia.Lawall <[email protected]>
Signed-off-by: Andrew Lunn <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Diffstat (limited to 'net/unix/af_unix.c')
0 files changed, 0 insertions, 0 deletions
