* re: phy: nxp-c45: add driver for tja1103
@ 2021-04-20 12:39 Colin Ian King
0 siblings, 0 replies; only message in thread
From: Colin Ian King @ 2021-04-20 12:39 UTC (permalink / raw)
To: Radu Pirea (NXP OSS)
Cc: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
Jakub Kicinski, linux-kernel, netdev
Hi,
Static analysis with Coverity on linux-next has found a potential issue
in drivers/net/phy/nxp-c45-tja11xx.c, function nxp_c45_get_phase_shift.
The analysis by Coverity is as follows:
350 static u64 nxp_c45_get_phase_shift(u64 phase_offset_raw)
351 {
352 /* The delay in degree phase is 73.8 + phase_offset_raw * 0.9.
353 * To avoid floating point operations we'll multiply by 10
354 * and get 1 decimal point precision.
355 */
356 phase_offset_raw *= 10;
Operands don't affect result (CONSTANT_EXPRESSION_RESULT)
result_independent_of_operands: phase_offset_raw is always assigned 0.
Did you intend to negate the value of phase_offset_raw instead of
assigning it 0? This occurs as the value assigned by "-".
357 phase_offset_raw -= phase_offset_raw;
358 return div_u64(phase_offset_raw, 9);
359 }
phase_offset_raw -= phase_offset_raw results in phase_offset_raw being
zero, I don't think that was the intent.
Colin
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-04-20 12:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-20 12:39 phy: nxp-c45: add driver for tja1103 Colin Ian King
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).