Skip to content

Commit 813ce67

Browse files
theadibmmahadevan108
authored andcommitted
mcux-sdk-ng: enet: fsl_enet: avoid possible race condition on timestamp
Only correct second value if the nanosecond has reasonably value. Signed-off-by: Adib Taraben <[email protected]>
1 parent ad531e7 commit 813ce67

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mcux/mcux-sdk-ng/drivers/enet/fsl_enet.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2995,7 +2995,7 @@ void ENET_Ptp1588GetTimer(ENET_Type *base, enet_handle_t *handle, enet_ptp_time_
29952995
ENET_Ptp1588GetTimerNoIrqDisable(base, handle, ptpTime);
29962996

29972997
/* Get PTP timer wrap event. */
2998-
if (0U != (base->EIR & (uint32_t)kENET_TsTimerInterrupt))
2998+
if (0U != (base->EIR & (uint32_t)kENET_TsTimerInterrupt) && ptpTime->nanosecond < (ENET_NANOSECOND_ONE_SECOND / 2))
29992999
{
30003000
ptpTime->second++;
30013001
}

0 commit comments

Comments
 (0)