* Coverity: bcm54140_hwmon_read_in(): Control flow issues
@ 2020-04-23 19:15 coverity-bot
0 siblings, 0 replies; only message in thread
From: coverity-bot @ 2020-04-23 19:15 UTC (permalink / raw)
To: Michael Walle
Cc: Guenter Roeck, David S. Miller, Andrew Lunn, Gustavo A. R. Silva,
linux-next
Hello!
This is an experimental semi-automated report about issues detected by
Coverity from a scan of next-20200423 as part of the linux-next scan project:
https://scan.coverity.com/projects/linux-next-weekly-scan
You're getting this email because you were associated with the identified
lines of code (noted below) that were touched by commits:
Mon Apr 20 20:21:13 2020 +0200
4406d36dfdf1 ("net: phy: bcm54140: add hwmon support")
Coverity reported the following:
*** CID 1492709: Control flow issues (NO_EFFECT)
/drivers/net/phy/bcm54140.c: 247 in bcm54140_hwmon_read_in()
241 return bcm54140_hwmon_read_alarm(dev, bit, val);
242 default:
243 return -EOPNOTSUPP;
244 }
245
246 tmp = bcm_phy_read_rdb(phydev, reg);
vvv CID 1492709: Control flow issues (NO_EFFECT)
vvv This less-than-zero comparison of an unsigned value is never true. "tmp < 0".
247 if (tmp < 0)
248 return tmp;
249
250 tmp &= BCM54140_HWMON_IN_MASK(channel);
251 *val = BCM54140_HWMON_TO_IN(channel, tmp);
252
If this is a false positive, please let us know so we can mark it as
such, or teach the Coverity rules to be smarter. If not, please make
sure fixes get into linux-next. :) For patches fixing this, please
include these lines (but double-check the "Fixes" first):
Human edit:
This is present on line 214 as well. (bcm_phy_read_rdb() returns int,
but tmp is u16.)
Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
Addresses-Coverity-ID: 1492709 ("Control flow issues")
Fixes: 4406d36dfdf1 ("net: phy: bcm54140: add hwmon support")
Thanks for your attention!
--
Coverity-bot
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-04-23 19:15 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-23 19:15 Coverity: bcm54140_hwmon_read_in(): Control flow issues coverity-bot
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).