re: phy: nxp-c45: add driver for tja1103

From: Colin Ian King
Date: Tue Apr 20 2021 - 08:39:59 EST


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