msg: Detect missing HW time stamps on duplicated messages.

As of 510777deca 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: 51b540875f ("msg: Introduce a method to copy a message.")

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2018-04-16 13:55:06 -07:00
parent 7a76c36b34
commit 29cd088347
1 changed files with 7 additions and 4 deletions

11
msg.c
View File

@ -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;
}