Discussion:
[Linuxptp-devel] [PATCH] Reset utc_timescale in clock_create() with HW time stamping.
Miroslav Lichvar
2013-07-09 10:42:52 UTC
Permalink
Signed-off-by: Miroslav Lichvar <***@redhat.com>
---
clock.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/clock.c b/clock.c
index b097911..267fe4e 100644
--- a/clock.c
+++ b/clock.c
@@ -613,6 +613,7 @@ struct clock *clock_create(int phc_index, struct interface *iface, int count,
pr_err("Failed to open %s: %m", phc);
return NULL;
}
+ c->utc_timescale = 0;
max_adj = phc_max_adj(c->clkid);
if (!max_adj) {
pr_err("clock is not adjustable");
--
1.8.1.4
Richard Cochran
2013-07-16 18:56:26 UTC
Permalink
Post by Miroslav Lichvar
---
clock.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/clock.c b/clock.c
index b097911..267fe4e 100644
--- a/clock.c
+++ b/clock.c
@@ -613,6 +613,7 @@ struct clock *clock_create(int phc_index, struct interface *iface, int count,
pr_err("Failed to open %s: %m", phc);
return NULL;
}
+ c->utc_timescale = 0;
Isn't this field already zero?

The first time clock_create() is called, 'the_clock' is zero by virtue
of being from the BBS section.

The second time (if there every was one), 'the_clock' is cleared by
memset() in clock_destroy().

Or maybe you see something I have missed?

Thanks,
Richard
Miroslav Lichvar
2013-07-17 08:24:53 UTC
Permalink
Post by Richard Cochran
Post by Miroslav Lichvar
@@ -613,6 +613,7 @@ struct clock *clock_create(int phc_index, struct interface *iface, int count,
pr_err("Failed to open %s: %m", phc);
return NULL;
}
+ c->utc_timescale = 0;
Isn't this field already zero?
The first time clock_create() is called, 'the_clock' is zero by virtue
of being from the BBS section.
The second time (if there every was one), 'the_clock' is cleared by
memset() in clock_destroy().
Or maybe you see something I have missed?
I didn't notice the memset call in clock_destroy. However, there are
other fields set to 0 in the function and I think it would improve the
readability a little bit. I'll leave that up to you.

Thanks,
--
Miroslav Lichvar
Loading...