phc2sys: check that specified interface has a PHC.

master
Miroslav Lichvar 2012-12-18 14:00:50 +01:00 committed by Richard Cochran
parent 84c7ac6b52
commit 3d4ff7882f
1 changed files with 4 additions and 0 deletions

View File

@ -331,6 +331,10 @@ int main(int argc, char *argv[])
fprintf(stderr, "can't autodiscover PHC device\n");
return -1;
}
if (ts_info.phc_index < 0) {
fprintf(stderr, "interface %s doesn't have a PHC\n", ethdev);
return -1;
}
sprintf(phc_device, "/dev/ptp%d", ts_info.phc_index);
src = clock_open(phc_device);
}