phc2sys: Fix crash when trying to synchronize unadjustable clock.

A clock that cannot be adjusted has no servo. Check if a servo is
present before updating the clock.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
master
Miroslav Lichvar 2018-11-12 17:28:03 +01:00 committed by Richard Cochran
parent 8142da41b6
commit 3c7e4947e4
1 changed files with 5 additions and 0 deletions

View File

@ -782,6 +782,11 @@ static int do_loop(struct node *node, int subscriptions)
!strcmp(clock->device, node->master->device)) !strcmp(clock->device, node->master->device))
continue; continue;
if (!clock->servo) {
pr_err("cannot update clock without servo");
return -1;
}
if (clock->clkid == CLOCK_REALTIME && if (clock->clkid == CLOCK_REALTIME &&
node->master->sysoff_method >= 0) { node->master->sysoff_method >= 0) {
/* use sysoff */ /* use sysoff */