]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
watchdog: asm9260_wdt: fix error handling in asm9260_wdt_probe()
authorAlexey Khoroshilov <khoroshilov@ispras.ru>
Sat, 10 Feb 2018 10:17:27 +0000 (13:17 +0300)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Mon, 27 Aug 2018 14:40:05 +0000 (16:40 +0200)
BugLink: http://bugs.launchpad.net/bugs/1786352
[ Upstream commit 3c829f47e33eb0398a9a14e357a05199a7be0277 ]

If devm_reset_control_get_exclusive() fails, asm9260_wdt_probe()
returns immediately. But clks has been already enabled at that point,
so it is required to disable them or to move the code around.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/watchdog/asm9260_wdt.c

index 7dd0da644a7f68fc7b1163d1eb12d07fd8c04f3b..2cf56b459d84c37411a9647d5fbf92927f5091a1 100644 (file)
@@ -292,14 +292,14 @@ static int asm9260_wdt_probe(struct platform_device *pdev)
        if (IS_ERR(priv->iobase))
                return PTR_ERR(priv->iobase);
 
-       ret = asm9260_wdt_get_dt_clks(priv);
-       if (ret)
-               return ret;
-
        priv->rst = devm_reset_control_get_exclusive(&pdev->dev, "wdt_rst");
        if (IS_ERR(priv->rst))
                return PTR_ERR(priv->rst);
 
+       ret = asm9260_wdt_get_dt_clks(priv);
+       if (ret)
+               return ret;
+
        wdd = &priv->wdd;
        wdd->info = &asm9260_wdt_ident;
        wdd->ops = &asm9260_wdt_ops;