mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-04 10:12:16 +09:00
ice: Use div64_u64 instead of div_u64 in adjfine
[ Upstream commit0013881c11] 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. Fixes:06c16d89d2("ice: register 1588 PTP clock device object for E810 devices") Signed-off-by: Karol Kolacinski <karol.kolacinski@intel.com> Tested-by: Gurucharan G <gurucharanx.g@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
68014890e4
commit
89f9c88014
@@ -459,7 +459,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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user