ptp4l: throw a fault for other port event failures
this patch makes sure every function is checked for a negative return value and ensures that a fault is detected when these fail -v2- * Fixed only check the ones with return value -v3- * Modified the delay_req functions to return 0 on nonfault cases Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>master
parent
d7bcdca7a9
commit
821798da9d
12
port.c
12
port.c
|
@ -756,11 +756,11 @@ static int process_delay_req(struct port *p, struct ptp_message *m)
|
||||||
int cnt, err = 0, pdulen;
|
int cnt, err = 0, pdulen;
|
||||||
|
|
||||||
if (p->state != PS_MASTER && p->state != PS_GRAND_MASTER)
|
if (p->state != PS_MASTER && p->state != PS_GRAND_MASTER)
|
||||||
return -1;
|
return 0;
|
||||||
|
|
||||||
if (p->delayMechanism == DM_P2P) {
|
if (p->delayMechanism == DM_P2P) {
|
||||||
pr_warning("port %hu: delay request on P2P port", portnum(p));
|
pr_warning("port %hu: delay request on P2P port", portnum(p));
|
||||||
return -1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
msg = msg_allocate();
|
msg = msg_allocate();
|
||||||
|
@ -879,7 +879,7 @@ static int process_pdelay_req(struct port *p, struct ptp_message *m)
|
||||||
|
|
||||||
if (p->delayMechanism == DM_E2E) {
|
if (p->delayMechanism == DM_E2E) {
|
||||||
pr_warning("port %hu: pdelay_req on E2E port", portnum(p));
|
pr_warning("port %hu: pdelay_req on E2E port", portnum(p));
|
||||||
return -1;
|
return 0;
|
||||||
}
|
}
|
||||||
if (p->delayMechanism == DM_AUTO) {
|
if (p->delayMechanism == DM_AUTO) {
|
||||||
pr_info("port %hu: peer detected, switch to P2P", portnum(p));
|
pr_info("port %hu: peer detected, switch to P2P", portnum(p));
|
||||||
|
@ -1294,10 +1294,12 @@ enum fsm_event port_event(struct port *p, int fd_index)
|
||||||
process_sync(p, msg);
|
process_sync(p, msg);
|
||||||
break;
|
break;
|
||||||
case DELAY_REQ:
|
case DELAY_REQ:
|
||||||
process_delay_req(p, msg);
|
if (process_delay_req(p, msg))
|
||||||
|
event = EV_FAULT_DETECTED;
|
||||||
break;
|
break;
|
||||||
case PDELAY_REQ:
|
case PDELAY_REQ:
|
||||||
process_pdelay_req(p, msg);
|
if (process_pdelay_req(p, msg))
|
||||||
|
event = EV_FAULT_DETECTED;
|
||||||
break;
|
break;
|
||||||
case PDELAY_RESP:
|
case PDELAY_RESP:
|
||||||
if (process_pdelay_resp(p, msg))
|
if (process_pdelay_resp(p, msg))
|
||||||
|
|
Loading…
Reference in New Issue