* re: phy: micrel: Add ethtool statistics counters
@ 2016-01-04 21:15 Dan Carpenter
2016-01-04 21:20 ` Andrew Lunn
2016-01-04 22:20 ` Dan Carpenter
0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2016-01-04 21:15 UTC (permalink / raw)
To: kernel-janitors
Hello Andrew Lunn,
The patch 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 }
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: phy: micrel: Add ethtool statistics counters
2016-01-04 21:15 phy: micrel: Add ethtool statistics counters Dan Carpenter
@ 2016-01-04 21:20 ` Andrew Lunn
2016-01-04 22:20 ` Dan Carpenter
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2016-01-04 21:20 UTC (permalink / raw)
To: kernel-janitors
On Tue, Jan 05, 2016 at 12:15:45AM +0300, Dan Carpenter wrote:
> Hello Andrew Lunn,
>
> The patch 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!
Yep, will fix.
You might see the same from the Marvell phy driver...
Andrew
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: phy: micrel: Add ethtool statistics counters
2016-01-04 21:15 phy: micrel: Add ethtool statistics counters Dan Carpenter
2016-01-04 21:20 ` Andrew Lunn
@ 2016-01-04 22:20 ` Dan Carpenter
1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2016-01-04 22:20 UTC (permalink / raw)
To: kernel-janitors
Also:
drivers/net/phy/marvell.c:1037 marvell_get_stat() warn: unsigned 'val' is never less than zero.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-01-04 22:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-04 21:15 phy: micrel: Add ethtool statistics counters Dan Carpenter
2016-01-04 21:20 ` Andrew Lunn
2016-01-04 22:20 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).