Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

watchdog: armada_37xx_wdt: check the return value of devm_ioremap() in armada_37xx_wdt_probe()

The function devm_ioremap() in armada_37xx_wdt_probe() can fail, so
its return value should be checked.

Fixes: 54e3d9b518c8a ("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>

authored by

William Dean and committed by
Wim Van Sebroeck
2d27e528 30ebc985

+2
+2
drivers/watchdog/armada_37xx_wdt.c
··· 274 274 if (!res) 275 275 return -ENODEV; 276 276 dev->reg = devm_ioremap(&pdev->dev, res->start, resource_size(res)); 277 + if (!dev->reg) 278 + return -ENOMEM; 277 279 278 280 /* init clock */ 279 281 dev->clk = devm_clk_get(&pdev->dev, NULL);