Discussion:
[Linuxptp-devel] [PATCH] Add missing state setting in PI servo when date check fails.
Miroslav Lichvar
2013-06-18 10:09:36 UTC
Permalink
Signed-off-by: Miroslav Lichvar <***@redhat.com>
---
pi.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/pi.c b/pi.c
index 427cb3e..78cbd3f 100644
--- a/pi.c
+++ b/pi.c
@@ -76,6 +76,7 @@ static double pi_sample(struct servo *servo,

/* Make sure the first sample is older than the second. */
if (s->local[0] >= s->local[1]) {
+ *state = SERVO_UNLOCKED;
s->count = 0;
break;
}
--
1.8.1.4
Richard Cochran
2013-06-18 16:13:49 UTC
Permalink
Post by Miroslav Lichvar
---
pi.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/pi.c b/pi.c
index 427cb3e..78cbd3f 100644
--- a/pi.c
+++ b/pi.c
@@ -76,6 +76,7 @@ static double pi_sample(struct servo *servo,
/* Make sure the first sample is older than the second. */
if (s->local[0] >= s->local[1]) {
+ *state = SERVO_UNLOCKED;
But isn't the state already "unlocked" and unchanged from before?
Post by Miroslav Lichvar
s->count = 0;
break;
}
Thanks,
Richard
Miroslav Lichvar
2013-06-18 16:36:17 UTC
Permalink
Post by Richard Cochran
Post by Miroslav Lichvar
@@ -76,6 +76,7 @@ static double pi_sample(struct servo *servo,
/* Make sure the first sample is older than the second. */
if (s->local[0] >= s->local[1]) {
+ *state = SERVO_UNLOCKED;
But isn't the state already "unlocked" and unchanged from before?
It depends on the caller, but I don't think it should be required to
keep it. In ptp4l it's always set to SERVO_UNLOCKED, but in phc2sys
it's an uninitialized variable on stack.

Thanks,
--
Miroslav Lichvar
Richard Cochran
2013-06-18 16:57:31 UTC
Permalink
Post by Miroslav Lichvar
It depends on the caller, but I don't think it should be required to
keep it. In ptp4l it's always set to SERVO_UNLOCKED, but in phc2sys
it's an uninitialized variable on stack.
Okay, applied.

Thanks,
Richard

Loading...