]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commit
watchdog: imx2_wdt: fix min() calculation in imx2_wdt_set_timeout
authorRasmus Villemoes <linux@rasmusvillemoes.dk>
Mon, 12 Aug 2019 13:13:56 +0000 (15:13 +0200)
committerKhalid Elmously <khalid.elmously@canonical.com>
Fri, 18 Oct 2019 08:26:34 +0000 (04:26 -0400)
commit1b589cc60c3c09da72c1f24a136c594938f25a30
treed45cfcceb13ab05d5d53fdd0d3c1caf468660f1a
parent062982bb0dbcd9f2fe669d293b223f041292b79c
watchdog: imx2_wdt: fix min() calculation in imx2_wdt_set_timeout

BugLink: https://bugs.launchpad.net/bugs/1848039
commit 144783a80cd2cbc45c6ce17db649140b65f203dd upstream.

Converting from ms to s requires dividing by 1000, not multiplying. So
this is currently taking the smaller of new_timeout and 1.28e8,
i.e. effectively new_timeout.

The driver knows what it set max_hw_heartbeat_ms to, so use that
value instead of doing a division at run-time.

FWIW, this can easily be tested by booting into a busybox shell and
doing "watchdog -t 5 -T 130 /dev/watchdog" - without this patch, the
watchdog fires after 130&127 == 2 seconds.

Fixes: b07e228eee69 "watchdog: imx2_wdt: Fix set_timeout for big timeout values"
Cc: stable@vger.kernel.org # 5.2 plus anything the above got backported to
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20190812131356.23039-1-linux@rasmusvillemoes.dk
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/watchdog/imx2_wdt.c