[Linuxptp-devel] [RFC v2 1/5] port.c: Add condition to check fc.
PTP IEEE 1588 stack for Linux
Brought to you by:
rcochran
From: Vedang P. <ved...@in...> - 2018-08-16 17:42:36
|
If foreign clock is NULL, both the clocks are obviously not equal. So, return 0 in that case. The above condition (fc == NULL) is not currently encountered. It will be encoutered in the next few patches which implement static roles for master and slave. Signed-off-by: Vedang Patel <ved...@in...> Change-Id: I195f32eee7500e96f6a4c1296c7dbc200908c943 --- port.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/port.c b/port.c index 5e0aed7df3cc..1a0e910a1151 100644 --- a/port.c +++ b/port.c @@ -144,6 +144,11 @@ static int msg_current(struct ptp_message *m, struct timespec now) static int msg_source_equal(struct ptp_message *m1, struct foreign_clock *fc) { struct PortIdentity *id1, *id2; + + if (!fc) { + return 0; + } + id1 = &m1->header.sourcePortIdentity; id2 = &fc->dataset.sender; return 0 == memcmp(id1, id2, sizeof(*id1)); -- 2.7.3 |