Skip to contentSkip to conversation

ice: Use div64_u64 instead of div_u64 in adjfine

PATCH New Karol Kolacinski 2 participants 2 messages Nov 4, 2021 – Dec 14, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ice: Use div64_u64 instead of div_u64 in adjfine

Change the division in ice_ptp_adjfine from div_u64 to div64_u64. div_u64 is used when the divisor is 32 bit but in this case incval is 64 bit and it caused incorrect calculations and incval adjustments.

---
 drivers/net/ethernet/intel/ice/ice_ptp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_ptp.c +1 -1
index 2b3b2060b504..2149595cc632 100644
@@ -1104,7 +1104,7 @@ static int ice_ptp_adjfine(struct ptp_clock_info *info, long scaled_ppm)
 		scaled_ppm = -scaled_ppm;
 	}
 
-	while ((u64)scaled_ppm > div_u64(U64_MAX, incval)) {
+	while ((u64)scaled_ppm > div64_u64(U64_MAX, incval)) {
 		/* handle overflow by scaling down the scaled_ppm and
 		 * the divisor, losing some precision
 		 */
Signature · 1 line
2.32.0
#1 lore raw

PATCH 1/1 ice: Use div64_u64 instead of div_u64 in adjfine

Quoted 11 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Karol Kolacinski
Sent: Thursday, November 4, 2021 7:22 PM
To: intel-wired-lan at lists.osuosl.org
Cc: Kolacinski, Karol <[email protected]>
Subject: [Intel-wired-lan] [PATCH intel-next] ice: Use div64_u64 instead of div_u64 in adjfine

Quoted 9 lines

Change the division in ice_ptp_adjfine from div_u64 to div64_u64. div_u64 is used when the divisor is 32 bit but in this case incval is 64 bit and it caused incorrect calculations and incval adjustments.

---
 drivers/net/ethernet/intel/ice/ice_ptp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)