Issue:
Setting watchdog timeout disables watchdog exception.
Steps to reproduce:
In a C program
int fd = open("/dev/watchdog0",O_RDWR);
int interval = 20;
ioctl(fd,WDIOC_SETTIMEOUT, &interval);
close(fd);
Execute and wait for the timeout to expire.
Result:
When the watchdog expires a hardware reset is generated immediately instead of an watchdog exception.
Additional info:
As a workaround you may either stop and start the watchdog or simply close and open the watchdog device after setting the timeout.
Analysis:
Applying the attached patch seems to solve the issue.