Discussion:
[Linuxptp-devel] [PATCH] phc2sys: fix overwriting of the clock state
Jiri Benc
2014-11-13 17:18:12 UTC
Permalink
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 <***@gmail.com>
Signed-off-by: Jiri Benc <***@redhat.com>
---
phc2sys.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/phc2sys.c b/phc2sys.c
index 22eb9c965ce9..67d8a588288f 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;
--
1.8.3.1
Richard Cochran
2014-11-18 15:07:53 UTC
Permalink
Post by Jiri Benc
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.
Applied.

Thanks,
Richard

Loading...