Skip to content

Commit 64311c7

Browse files
harini-katakamclaudiubeznea
authored andcommitted
net: macb: Fix ptp time adjustment for large negative delta
When delta passed to gem_ptp_adjtime is negative, the sign is maintained in the ns_to_timespec64 conversion. Hence timespec_add should be used directly. timespec_sub will just subtract the negative value thus increasing the time difference. Signed-off-by: Harini Katakam <harini.katakam@xilinx.com> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 1e36ba1 commit 64311c7

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

drivers/net/ethernet/cadence/macb_ptp.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,7 @@ static int gem_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
170170

171171
if (delta > TSU_NSEC_MAX_VAL) {
172172
gem_tsu_get_time(&bp->ptp_clock_info, &now);
173-
if (sign)
174-
now = timespec64_sub(now, then);
175-
else
176-
now = timespec64_add(now, then);
173+
now = timespec64_add(now, then);
177174

178175
gem_tsu_set_time(&bp->ptp_clock_info,
179176
(const struct timespec64 *)&now);

0 commit comments

Comments
 (0)