From 29cd0883475ef2949076c741fb083a7cc5b0fa2b Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Mon, 16 Apr 2018 13:55:06 -0700 Subject: [PATCH] msg: Detect missing HW time stamps on duplicated messages. As of 510777deca1d message layer no longer returns -ETIME. Callers of msg_post_recv() are expected to check for missing time stamps themselves, but the message duplication function followed the obsolete code pattern of expecting that msg_post_recv() performs the check. This patch fixes the method to check properly for this error condition. Fixes: 51b540875fab ("msg: Introduce a method to copy a message.") Signed-off-by: Richard Cochran --- msg.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/msg.c b/msg.c index a4a44fd..090715b 100644 --- a/msg.c +++ b/msg.c @@ -315,10 +315,6 @@ struct ptp_message *msg_duplicate(struct ptp_message *msg, int cnt) case -EBADMSG: pr_err("msg_duplicate: bad message"); break; - case -ETIME: - pr_err("msg_duplicate: received %s without timestamp", - msg_type_string(msg_type(msg))); - break; case -EPROTO: pr_debug("msg_duplicate: ignoring message"); break; @@ -326,6 +322,13 @@ struct ptp_message *msg_duplicate(struct ptp_message *msg, int cnt) msg_put(dup); return NULL; } + if (msg_sots_missing(msg)) { + pr_err("msg_duplicate: received %s without timestamp", + msg_type_string(msg_type(msg))); + msg_put(dup); + return NULL; + } + return dup; }