Skip to content

Commit 9cfce47

Browse files
John CrispinWim Van Sebroeck
authored andcommitted
watchdog: lantiq: fix watchdogs timeout handling
The enable function was using the global timeout variable for local operations. This resulted in the value of the global variable being corrupted, thus breaking the code. Signed-off-by: John Crispin <blogic@openwrt.org> Signed-off-by: Thomas Langer <thomas.langer@lantiq.com> Signed-off-by: Wim Van Sebroeck <wim@iguana.be> Cc: linux-watchdog@vger.kernel.org Cc: linux-mips@linux-mips.org
1 parent dbc018e commit 9cfce47

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎drivers/watchdog/lantiq_wdt.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,16 @@ static int ltq_wdt_ok_to_close;
5151
static void
5252
ltq_wdt_enable(void)
5353
{
54-
ltq_wdt_timeout = ltq_wdt_timeout *
54+
unsigned long int timeout = ltq_wdt_timeout *
5555
(ltq_io_region_clk_rate / LTQ_WDT_DIVIDER) + 0x1000;
56-
if (ltq_wdt_timeout > LTQ_MAX_TIMEOUT)
57-
ltq_wdt_timeout = LTQ_MAX_TIMEOUT;
56+
if (timeout > LTQ_MAX_TIMEOUT)
57+
timeout = LTQ_MAX_TIMEOUT;
5858

5959
/* write the first password magic */
6060
ltq_w32(LTQ_WDT_PW1, ltq_wdt_membase + LTQ_WDT_CR);
6161
/* write the second magic plus the configuration and new timeout */
6262
ltq_w32(LTQ_WDT_SR_EN | LTQ_WDT_SR_PWD | LTQ_WDT_SR_CLKDIV |
63-
LTQ_WDT_PW2 | ltq_wdt_timeout, ltq_wdt_membase + LTQ_WDT_CR);
63+
LTQ_WDT_PW2 | timeout, ltq_wdt_membase + LTQ_WDT_CR);
6464
}
6565

6666
static void

0 commit comments

Comments
 (0)