]> git.baikalelectronics.ru Git - kernel.git/commitdiff
watchdog: armada_37xx_wdt: check the return value of devm_ioremap() in armada_37xx_wd...
authorWilliam Dean <williamsukatube@gmail.com>
Fri, 22 Jul 2022 03:09:38 +0000 (11:09 +0800)
committerWim Van Sebroeck <wim@linux-watchdog.org>
Sat, 23 Jul 2022 12:26:42 +0000 (14:26 +0200)
The function devm_ioremap() in armada_37xx_wdt_probe() can fail, so
its return value should be checked.

Fixes: 63a453f0cb72d ("watchdog: Add support for Armada 37xx CPU watchdog")
Reported-by: Hacash Robot <hacashRobot@santino.com>
Signed-off-by: William Dean <williamsukatube@gmail.com>
Reviewed-by: Marek Beh=C3=BAn <kabel@kernel.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20220722030938.2925156-1-williamsukatube@163.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
drivers/watchdog/armada_37xx_wdt.c

index 1635f421ef2c380ecc69cfe106d60304b96874e4..854b1cc723cb602a070c903e8a2dc13d76cc979c 100644 (file)
@@ -274,6 +274,8 @@ static int armada_37xx_wdt_probe(struct platform_device *pdev)
        if (!res)
                return -ENODEV;
        dev->reg = devm_ioremap(&pdev->dev, res->start, resource_size(res));
+       if (!dev->reg)
+               return -ENOMEM;
 
        /* init clock */
        dev->clk = devm_clk_get(&pdev->dev, NULL);