refclock: drop return after LOG_FATAL
The LOG_FATAL macro expands to (emitting the message and then) exit(1). So a return after LOG_FATAL isn't reached. Drop all those to simplify the code a bit.
This commit is contained in:
parent
2ca2c85365
commit
aa22c515ce
2 changed files with 10 additions and 25 deletions
|
@ -66,10 +66,8 @@ static int phc_initialise(RCL_Instance instance)
|
||||||
path = RCL_GetDriverParameter(instance);
|
path = RCL_GetDriverParameter(instance);
|
||||||
|
|
||||||
phc_fd = SYS_Linux_OpenPHC(path, 0);
|
phc_fd = SYS_Linux_OpenPHC(path, 0);
|
||||||
if (phc_fd < 0) {
|
if (phc_fd < 0)
|
||||||
LOG_FATAL("Could not open PHC");
|
LOG_FATAL("Could not open PHC");
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
phc = MallocNew(struct phc_instance);
|
phc = MallocNew(struct phc_instance);
|
||||||
phc->fd = phc_fd;
|
phc->fd = phc_fd;
|
||||||
|
|
|
@ -61,49 +61,36 @@ static int pps_initialise(RCL_Instance instance) {
|
||||||
edge_clear = RCL_GetDriverOption(instance, "clear") ? 1 : 0;
|
edge_clear = RCL_GetDriverOption(instance, "clear") ? 1 : 0;
|
||||||
|
|
||||||
fd = open(path, O_RDWR);
|
fd = open(path, O_RDWR);
|
||||||
if (fd < 0) {
|
if (fd < 0)
|
||||||
LOG_FATAL("Could not open %s : %s", path, strerror(errno));
|
LOG_FATAL("Could not open %s : %s", path, strerror(errno));
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
UTI_FdSetCloexec(fd);
|
UTI_FdSetCloexec(fd);
|
||||||
|
|
||||||
if (time_pps_create(fd, &handle) < 0) {
|
if (time_pps_create(fd, &handle) < 0)
|
||||||
LOG_FATAL("time_pps_create() failed on %s : %s", path, strerror(errno));
|
LOG_FATAL("time_pps_create() failed on %s : %s", path, strerror(errno));
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (time_pps_getcap(handle, &mode) < 0) {
|
if (time_pps_getcap(handle, &mode) < 0)
|
||||||
LOG_FATAL("time_pps_getcap() failed on %s : %s", path, strerror(errno));
|
LOG_FATAL("time_pps_getcap() failed on %s : %s", path, strerror(errno));
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (time_pps_getparams(handle, ¶ms) < 0) {
|
if (time_pps_getparams(handle, ¶ms) < 0)
|
||||||
LOG_FATAL("time_pps_getparams() failed on %s : %s", path, strerror(errno));
|
LOG_FATAL("time_pps_getparams() failed on %s : %s", path, strerror(errno));
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!edge_clear) {
|
if (!edge_clear) {
|
||||||
if (!(mode & PPS_CAPTUREASSERT)) {
|
if (!(mode & PPS_CAPTUREASSERT))
|
||||||
LOG_FATAL("CAPTUREASSERT not supported on %s", path);
|
LOG_FATAL("CAPTUREASSERT not supported on %s", path);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
params.mode |= PPS_CAPTUREASSERT;
|
params.mode |= PPS_CAPTUREASSERT;
|
||||||
params.mode &= ~PPS_CAPTURECLEAR;
|
params.mode &= ~PPS_CAPTURECLEAR;
|
||||||
} else {
|
} else {
|
||||||
if (!(mode & PPS_CAPTURECLEAR)) {
|
if (!(mode & PPS_CAPTURECLEAR))
|
||||||
LOG_FATAL("CAPTURECLEAR not supported on %s", path);
|
LOG_FATAL("CAPTURECLEAR not supported on %s", path);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
params.mode |= PPS_CAPTURECLEAR;
|
params.mode |= PPS_CAPTURECLEAR;
|
||||||
params.mode &= ~PPS_CAPTUREASSERT;
|
params.mode &= ~PPS_CAPTUREASSERT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (time_pps_setparams(handle, ¶ms) < 0) {
|
if (time_pps_setparams(handle, ¶ms) < 0)
|
||||||
LOG_FATAL("time_pps_setparams() failed on %s : %s", path, strerror(errno));
|
LOG_FATAL("time_pps_setparams() failed on %s : %s", path, strerror(errno));
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
pps = MallocNew(struct pps_instance);
|
pps = MallocNew(struct pps_instance);
|
||||||
pps->handle = handle;
|
pps->handle = handle;
|
||||||
|
|
Loading…
Reference in a new issue