selftests: watchdog: point out ioctl() failures

Report the failure of WDIOC_SETOPTIONS/WDIOC_SETTIMEOUT ioctls.

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
This commit is contained in:
Eugeniu Rosca 2017-07-01 14:57:28 +02:00 committed by Shuah Khan
parent 7a5e10d439
commit 42f34c4e24

View File

@ -94,12 +94,16 @@ int main(int argc, char *argv[])
ret = ioctl(fd, WDIOC_SETOPTIONS, &flags); ret = ioctl(fd, WDIOC_SETOPTIONS, &flags);
if (!ret) if (!ret)
printf("Watchdog card disabled.\n"); printf("Watchdog card disabled.\n");
else
printf("WDIOS_DISABLECARD errno '%s'\n", strerror(errno));
break; break;
case 'e': case 'e':
flags = WDIOS_ENABLECARD; flags = WDIOS_ENABLECARD;
ret = ioctl(fd, WDIOC_SETOPTIONS, &flags); ret = ioctl(fd, WDIOC_SETOPTIONS, &flags);
if (!ret) if (!ret)
printf("Watchdog card enabled.\n"); printf("Watchdog card enabled.\n");
else
printf("WDIOS_ENABLECARD errno '%s'\n", strerror(errno));
break; break;
case 'p': case 'p':
ping_rate = strtoul(optarg, NULL, 0); ping_rate = strtoul(optarg, NULL, 0);
@ -110,6 +114,8 @@ int main(int argc, char *argv[])
ret = ioctl(fd, WDIOC_SETTIMEOUT, &flags); ret = ioctl(fd, WDIOC_SETTIMEOUT, &flags);
if (!ret) if (!ret)
printf("Watchdog timeout set to %u seconds.\n", flags); printf("Watchdog timeout set to %u seconds.\n", flags);
else
printf("WDIOC_SETTIMEOUT errno '%s'\n", strerror(errno));
break; break;
default: default:
usage(argv[0]); usage(argv[0]);