summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorHarini Katakam <harini.katakam@xilinx.com>2018-06-20 14:34:20 +0300
committerDavid S. Miller <davem@davemloft.net>2018-06-21 09:01:06 +0300
commit64d7839af8c8f67daaf9bf387135052c55d85f90 (patch)
tree7d59de6ffe0b966393e97ad77dff7944c9b158e5 /drivers
parent30877961b1cdd6fdca783c2e8c4f0f47e95dc58c (diff)
downloadlinux-64d7839af8c8f67daaf9bf387135052c55d85f90.tar.xz
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/cadence/macb_ptp.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/net/ethernet/cadence/macb_ptp.c b/drivers/net/ethernet/cadence/macb_ptp.c
index 2220c771092b..678835136bf8 100644
--- a/drivers/net/ethernet/cadence/macb_ptp.c
+++ b/drivers/net/ethernet/cadence/macb_ptp.c
@@ -170,10 +170,7 @@ static int gem_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
if (delta > TSU_NSEC_MAX_VAL) {
gem_tsu_get_time(&bp->ptp_clock_info, &now);
- if (sign)
- now = timespec64_sub(now, then);
- else
- now = timespec64_add(now, then);
+ now = timespec64_add(now, then);
gem_tsu_set_time(&bp->ptp_clock_info,
(const struct timespec64 *)&now);