From 7455c241485e01da12d107f5b665e10794330967 Mon Sep 17 00:00:00 2001 From: Jiri Benc Date: Thu, 13 Nov 2014 18:18:12 +0100 Subject: [PATCH] phc2sys: fix overwriting of the clock state The reconfigure function is missing a check whether state for the given clock actually changed or not. This caused state for all unchanged ports to be zeroed. Reported-by: Richard Cochran Signed-off-by: Jiri Benc --- phc2sys.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/phc2sys.c b/phc2sys.c index 22eb9c9..67d8a58 100644 --- a/phc2sys.c +++ b/phc2sys.c @@ -305,11 +305,13 @@ static void reconfigure(struct node *node) continue; } - if (c->new_state == PS_MASTER) - clock_reinit(c); + if (c->new_state) { + if (c->new_state == PS_MASTER) + clock_reinit(c); - c->state = c->new_state; - c->new_state = 0; + c->state = c->new_state; + c->new_state = 0; + } if (c->state == PS_SLAVE) { src = c;