]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
watchdog: realtek-otto: enable clock before using I/O
authorSander Vanheule <sander@svanheule.net>
Fri, 15 May 2026 21:23:51 +0000 (23:23 +0200)
committerGuenter Roeck <linux@roeck-us.net>
Sat, 16 May 2026 17:37:57 +0000 (10:37 -0700)
As the watchdog is normally on the same bus as the UART peripheral, the
bootloader will have ensured the bus' clock is up and running before the
watchdog driver is probed. Nevertheless, let's do things the right way
and enable the watchdog's clock before performing I/O accesses.

Signed-off-by: Sander Vanheule <sander@svanheule.net>
Link: https://lore.kernel.org/r/20260515212351.752054-3-sander@svanheule.net
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/watchdog/realtek_otto_wdt.c

index 1495e8a8cbb5da104b8044375590b64b68da1910..01b3ef89bacfca6f75a432d33b37369644a424e5 100644 (file)
@@ -296,15 +296,15 @@ static int otto_wdt_probe(struct platform_device *pdev)
        if (IS_ERR(ctrl->base))
                return PTR_ERR(ctrl->base);
 
+       ret = otto_wdt_probe_clk(ctrl);
+       if (ret)
+               return ret;
+
        /* Clear any old interrupts and reset initial state */
        iowrite32(OTTO_WDT_INTR_PHASE_1 | OTTO_WDT_INTR_PHASE_2,
                        ctrl->base + OTTO_WDT_REG_INTR);
        iowrite32(OTTO_WDT_CTRL_DEFAULT, ctrl->base + OTTO_WDT_REG_CTRL);
 
-       ret = otto_wdt_probe_clk(ctrl);
-       if (ret)
-               return ret;
-
        ctrl->irq_phase1 = platform_get_irq_byname(pdev, "phase1");
        if (ctrl->irq_phase1 < 0)
                return ctrl->irq_phase1;