Messages in this thread | ![/](/images/icornerl.gif) | | Date | Thu, 21 Apr 2022 22:50:29 -0700 | Subject | Re: [PATCH] Watchdog: Checking timeout invalid if hardware heartbeat range is configured | From | Guenter Roeck <> |
| |
On 4/21/22 16:31, liuxp11 wrote: > > diff --git a/drivers/watchdog/wdat_wdt.c b/drivers/watchdog/wdat_wdt.c > > > index 195c8c004b69..d166d33ce7ae 100644 > > --- a/drivers/watchdog/wdat_wdt.c > > +++ b/drivers/watchdog/wdat_wdt.c > > @@ -450,8 +450,7 @@ static int wdat_wdt_probe(struct platform_device *pdev) > > * watchdog properly after it has opened the device. In some cases > > * the BIOS default is too short and causes immediate reboot. > > */ > > - if (timeout * 1000 < wdat->wdd.min_hw_heartbeat_ms || > > - timeout * 1000 > wdat->wdd.max_hw_heartbeat_ms) { > > + if (watchdog_timeout_invalid(&wdat->wdd, timeout)) { > > dev_warn(dev, "Invalid timeout %d given, using %d\n", > > timeout, WDAT_DEFAULT_TIMEOUT); > > timeout = WDAT_DEFAULT_TIMEOUT; > Thanks your reply, read these code,thinking can put them into watchdog_timeout_invalid.
Again, no. If anything the above code is wrong; there should be no upper limit if max_hw_heartbeat_ms is provided. The code should probably set min_timeout and just call watchdog_timeout_invalid() without any change in that function.
Guenter
| ![\](/images/icornerr.gif) |