From ae662878e7ffa1f8aecdca0df9780ef1fb6b42de Mon Sep 17 00:00:00 2001 From: Rob Herring Date: Wed, 25 May 2022 20:41:27 -0500 Subject: [PATCH 01/24] dt-bindings: watchdog: faraday: Fix typo in example 'timeout-sec' property The 'unevaluatedProperties' schema checks is not fully working and doesn't catch some cases where there's a $ref to another schema. A fix is pending, but results in new warnings in examples. The correct common watchdog property is 'timeout-sec', not 'timeout-secs'. Signed-off-by: Rob Herring Reviewed-by: Linus Walleij Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20220526014127.2872254-1-robh@kernel.org Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck --- .../devicetree/bindings/watchdog/faraday,ftwdt010.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/watchdog/faraday,ftwdt010.yaml b/Documentation/devicetree/bindings/watchdog/faraday,ftwdt010.yaml index ca9e1beff76b..6ecd429f76b5 100644 --- a/Documentation/devicetree/bindings/watchdog/faraday,ftwdt010.yaml +++ b/Documentation/devicetree/bindings/watchdog/faraday,ftwdt010.yaml @@ -55,7 +55,7 @@ examples: compatible = "faraday,ftwdt010"; reg = <0x41000000 0x1000>; interrupts = <3 IRQ_TYPE_LEVEL_HIGH>; - timeout-secs = <5>; + timeout-sec = <5>; }; - | watchdog: watchdog@98500000 { From 97d5ec548150764946f38632e62e79759832b54b Mon Sep 17 00:00:00 2001 From: Jiasheng Jiang Date: Thu, 26 May 2022 16:03:03 +0800 Subject: [PATCH 02/24] watchdog: f71808e_wdt: Add check for platform_driver_register As platform_driver_register() could fail, it should be better to deal with the return value in order to maintain the code consisitency. Fixes: 27e0fe00a5c6 ("watchdog: f71808e_wdt: refactor to platform device/driver pair") Signed-off-by: Jiasheng Jiang Reviewed-by: Guenter Roeck https://lore.kernel.org/r/20220526080303.1005063-1-jiasheng@iscas.ac.cn Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck --- drivers/watchdog/f71808e_wdt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/watchdog/f71808e_wdt.c b/drivers/watchdog/f71808e_wdt.c index 7f59c680de25..6a16d3d0bb1e 100644 --- a/drivers/watchdog/f71808e_wdt.c +++ b/drivers/watchdog/f71808e_wdt.c @@ -634,7 +634,9 @@ static int __init fintek_wdt_init(void) pdata.type = ret; - platform_driver_register(&fintek_wdt_driver); + ret = platform_driver_register(&fintek_wdt_driver); + if (ret) + return ret; wdt_res.name = "superio port"; wdt_res.flags = IORESOURCE_IO; From 79ded5088dd1f327e64d14afaa522b25eb830384 Mon Sep 17 00:00:00 2001 From: Rohit Agarwal Date: Wed, 1 Jun 2022 16:15:10 +0530 Subject: [PATCH 03/24] dt-bindings: watchdog: Add binding for Qcom SDX65 Add devicetree binding for watchdog present in Qcom SDX65 platform. Signed-off-by: Rohit Agarwal Acked-by: Krzysztof Kozlowski Reviewed-by: Guenter Roeck https://lore.kernel.org/r/1654080312-5408-10-git-send-email-quic_rohiagar@quicinc.com Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck --- Documentation/devicetree/bindings/watchdog/qcom-wdt.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/watchdog/qcom-wdt.yaml b/Documentation/devicetree/bindings/watchdog/qcom-wdt.yaml index 2bd6b4a52637..d8ac0be36e6c 100644 --- a/Documentation/devicetree/bindings/watchdog/qcom-wdt.yaml +++ b/Documentation/devicetree/bindings/watchdog/qcom-wdt.yaml @@ -24,6 +24,7 @@ properties: - qcom,apss-wdt-sc8280xp - qcom,apss-wdt-sdm845 - qcom,apss-wdt-sdx55 + - qcom,apss-wdt-sdx65 - qcom,apss-wdt-sm6350 - qcom,apss-wdt-sm8150 - qcom,apss-wdt-sm8250 From 418c951d637a2685392f52fd26113bfe14408f89 Mon Sep 17 00:00:00 2001 From: Luca Ceresoli Date: Fri, 3 Jun 2022 17:57:27 +0200 Subject: [PATCH 04/24] watchdog: max77620: update Luca Ceresoli's e-mail address My Bootlin address is preferred from now on. Signed-off-by: Luca Ceresoli Signed-off-by: Luca Ceresoli Reviewed-by: Guenter Roeck https://lore.kernel.org/r20220603155727.1232061-6-luca@lucaceresoli.net Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck --- drivers/watchdog/max77620_wdt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/watchdog/max77620_wdt.c b/drivers/watchdog/max77620_wdt.c index b76ad6ba0915..33835c0b06de 100644 --- a/drivers/watchdog/max77620_wdt.c +++ b/drivers/watchdog/max77620_wdt.c @@ -6,7 +6,7 @@ * Copyright (C) 2022 Luca Ceresoli * * Author: Laxman Dewangan - * Author: Luca Ceresoli + * Author: Luca Ceresoli */ #include @@ -260,5 +260,5 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started " "(default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); MODULE_AUTHOR("Laxman Dewangan "); -MODULE_AUTHOR("Luca Ceresoli "); +MODULE_AUTHOR("Luca Ceresoli "); MODULE_LICENSE("GPL v2"); From c6d9c0798ed366a09a9e53d71edcd2266e34a6eb Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 21 Jun 2022 15:28:40 +0200 Subject: [PATCH 05/24] watchdog: sp5100_tco: Fix a memory leak of EFCH MMIO resource Unlike release_mem_region(), a call to release_resource() does not free the resource, so it has to be freed explicitly to avoid a memory leak. Signed-off-by: Jean Delvare Fixes: 0578fff4aae5 ("Watchdog: sp5100_tco: Add initialization using EFCH MMIO") Cc: Terry Bowman Cc: Wim Van Sebroeck Cc: Guenter Roeck Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20220621152840.420a0f4c@endymion.delvare Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck --- drivers/watchdog/sp5100_tco.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/watchdog/sp5100_tco.c b/drivers/watchdog/sp5100_tco.c index 86ffb58fbc85..ae54dd33e233 100644 --- a/drivers/watchdog/sp5100_tco.c +++ b/drivers/watchdog/sp5100_tco.c @@ -402,6 +402,7 @@ static int sp5100_tco_setupdevice_mmio(struct device *dev, iounmap(addr); release_resource(res); + kfree(res); return ret; } From 3b1905456aad0d111bba3388165e7bb78537db72 Mon Sep 17 00:00:00 2001 From: Bing Fan Date: Fri, 24 Jun 2022 10:24:42 +0800 Subject: [PATCH 06/24] watchdog: sp805_wdt: add arm cmsdk apb wdt support Support arm CMSDK ip apb watchdog device. Description details of this device can be found in the document DDI0479D_m_class_processor_system_r1p1_trm.pdf on the arm's document web. Which periphid is 0x001bb824. The registers are basically the same as the 805, just a few more: Periphid4/5/6/7 with offset 0xFD0/0xFD4/0xFD8/0xFDC. For the register description of arm,sp805, please refer to the document DDI0270-arm-sp805.pdf. Signed-off-by: Bing Fan Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/1656037482-19505-1-git-send-email-hptsfb@gmail.com Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck --- drivers/watchdog/sp805_wdt.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c index f9479a3fe2a6..78ba36689eec 100644 --- a/drivers/watchdog/sp805_wdt.c +++ b/drivers/watchdog/sp805_wdt.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * drivers/char/watchdog/sp805-wdt.c * @@ -341,6 +342,10 @@ static const struct amba_id sp805_wdt_ids[] = { .id = 0x00141805, .mask = 0x00ffffff, }, + { + .id = 0x001bb824, + .mask = 0x00ffffff, + }, { 0, 0 }, }; From 595d9a69c45dbb167562abb6f120cac571a545fa Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Mon, 27 Jun 2022 21:00:55 +0200 Subject: [PATCH 07/24] dt-bindings: watchdog: realtek,otto-wdt: add RTL9310 Add the realtek,rtl9310-wdt compatible to the Realtek Otto watchdog binding. Signed-off-by: Sander Vanheule Acked-by: Krzysztof Kozlowski Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/84d873d7dd375cd2392f89fa6bd9e0fe5dda4e1c.1656356377.git.sander@svanheule.net Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck --- Documentation/devicetree/bindings/watchdog/realtek,otto-wdt.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/watchdog/realtek,otto-wdt.yaml b/Documentation/devicetree/bindings/watchdog/realtek,otto-wdt.yaml index 11b220a5e0f6..099245fe7b10 100644 --- a/Documentation/devicetree/bindings/watchdog/realtek,otto-wdt.yaml +++ b/Documentation/devicetree/bindings/watchdog/realtek,otto-wdt.yaml @@ -29,6 +29,7 @@ properties: - realtek,rtl8380-wdt - realtek,rtl8390-wdt - realtek,rtl9300-wdt + - realtek,rtl9310-wdt reg: maxItems: 1 From c47c88555ffcc2deebea6140e66a9cac3b6302b8 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Mon, 27 Jun 2022 21:00:56 +0200 Subject: [PATCH 08/24] watchdog: realtek-otto: add RTL9310 support The RTL9310 SoC series has a watchdog timer identical to the already supported SoCs. The peripheral is memory mapped at 0x18003260 and driven by the Lexra bus clock. Signed-off-by: Sander Vanheule Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/629e95e16c8dc812dc5a4ea34a2e2e1ff2faf88c.1656356377.git.sander@svanheule.net Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck --- drivers/watchdog/realtek_otto_wdt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/watchdog/realtek_otto_wdt.c b/drivers/watchdog/realtek_otto_wdt.c index 60058a0c3ec4..2a5298c5e8e4 100644 --- a/drivers/watchdog/realtek_otto_wdt.c +++ b/drivers/watchdog/realtek_otto_wdt.c @@ -366,6 +366,7 @@ static const struct of_device_id otto_wdt_ids[] = { { .compatible = "realtek,rtl8380-wdt" }, { .compatible = "realtek,rtl8390-wdt" }, { .compatible = "realtek,rtl9300-wdt" }, + { .compatible = "realtek,rtl9310-wdt" }, { } }; MODULE_DEVICE_TABLE(of, otto_wdt_ids); From 3b956c0aae96eca7e527cdcaeb3a168640507372 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Tue, 28 Jun 2022 20:34:42 +0100 Subject: [PATCH 09/24] watchdog: bcm7038_wdt: Remove #ifdef guards for PM related functions Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. Not using #ifdef guards means that the code is always compiled independently of any Kconfig option, and thanks to that bugs and regressions are easier to catch. Signed-off-by: Paul Cercueil Cc: Florian Fainelli Cc: Broadcom internal kernel review list Reviewed-by: Florian Fainelli Tested-by: Florian Fainelli Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20220628193449.160585-2-paul@crapouillou.net Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck --- drivers/watchdog/bcm7038_wdt.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/watchdog/bcm7038_wdt.c b/drivers/watchdog/bcm7038_wdt.c index 1ffcf6aca6ae..9388838899ac 100644 --- a/drivers/watchdog/bcm7038_wdt.c +++ b/drivers/watchdog/bcm7038_wdt.c @@ -192,7 +192,6 @@ static int bcm7038_wdt_probe(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM_SLEEP static int bcm7038_wdt_suspend(struct device *dev) { struct bcm7038_watchdog *wdt = dev_get_drvdata(dev); @@ -212,10 +211,9 @@ static int bcm7038_wdt_resume(struct device *dev) return 0; } -#endif -static SIMPLE_DEV_PM_OPS(bcm7038_wdt_pm_ops, bcm7038_wdt_suspend, - bcm7038_wdt_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(bcm7038_wdt_pm_ops, + bcm7038_wdt_suspend, bcm7038_wdt_resume); static const struct of_device_id bcm7038_wdt_match[] = { { .compatible = "brcm,bcm6345-wdt" }, @@ -236,7 +234,7 @@ static struct platform_driver bcm7038_wdt_driver = { .driver = { .name = "bcm7038-wdt", .of_match_table = bcm7038_wdt_match, - .pm = &bcm7038_wdt_pm_ops, + .pm = pm_sleep_ptr(&bcm7038_wdt_pm_ops), } }; module_platform_driver(bcm7038_wdt_driver); From 4ccfb98938e50133332ff22bb932d2f529f73738 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Tue, 28 Jun 2022 20:34:43 +0100 Subject: [PATCH 10/24] watchdog: dw_wdt: Remove #ifdef guards for PM related functions Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. Not using #ifdef guards means that the code is always compiled independently of any Kconfig option, and thanks to that bugs and regressions are easier to catch. Signed-off-by: Paul Cercueil Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20220628193449.160585-3-paul@crapouillou.net Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck --- drivers/watchdog/dw_wdt.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c index cd578843277e..060dae67d852 100644 --- a/drivers/watchdog/dw_wdt.c +++ b/drivers/watchdog/dw_wdt.c @@ -375,7 +375,6 @@ static irqreturn_t dw_wdt_irq(int irq, void *devid) return IRQ_HANDLED; } -#ifdef CONFIG_PM_SLEEP static int dw_wdt_suspend(struct device *dev) { struct dw_wdt *dw_wdt = dev_get_drvdata(dev); @@ -410,9 +409,8 @@ static int dw_wdt_resume(struct device *dev) return 0; } -#endif /* CONFIG_PM_SLEEP */ -static SIMPLE_DEV_PM_OPS(dw_wdt_pm_ops, dw_wdt_suspend, dw_wdt_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(dw_wdt_pm_ops, dw_wdt_suspend, dw_wdt_resume); /* * In case if DW WDT IP core is synthesized with fixed TOP feature disabled the @@ -710,7 +708,7 @@ static struct platform_driver dw_wdt_driver = { .driver = { .name = "dw_wdt", .of_match_table = of_match_ptr(dw_wdt_of_match), - .pm = &dw_wdt_pm_ops, + .pm = pm_sleep_ptr(&dw_wdt_pm_ops), }, }; From d4777d0f29913711793708e1b3392390956a527f Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Tue, 28 Jun 2022 20:34:44 +0100 Subject: [PATCH 11/24] watchdog: mtk_wdt: Remove #ifdef guards for PM related functions Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. Not using #ifdef guards means that the code is always compiled independently of any Kconfig option, and thanks to that bugs and regressions are easier to catch. Signed-off-by: Paul Cercueil Cc: Matthias Brugger Cc: linux-arm-kernel@lists.infradead.org Cc: linux-mediatek@lists.infradead.org Reviewed-by: AngeloGioacchino Del Regno Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20220628193449.160585-4-paul@crapouillou.net Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck --- drivers/watchdog/mtk_wdt.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c index f0d4e3cc7459..e97787536792 100644 --- a/drivers/watchdog/mtk_wdt.c +++ b/drivers/watchdog/mtk_wdt.c @@ -401,7 +401,6 @@ static int mtk_wdt_probe(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM_SLEEP static int mtk_wdt_suspend(struct device *dev) { struct mtk_wdt_dev *mtk_wdt = dev_get_drvdata(dev); @@ -423,7 +422,6 @@ static int mtk_wdt_resume(struct device *dev) return 0; } -#endif static const struct of_device_id mtk_wdt_dt_ids[] = { { .compatible = "mediatek,mt2712-wdt", .data = &mt2712_data }, @@ -437,16 +435,14 @@ static const struct of_device_id mtk_wdt_dt_ids[] = { }; MODULE_DEVICE_TABLE(of, mtk_wdt_dt_ids); -static const struct dev_pm_ops mtk_wdt_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(mtk_wdt_suspend, - mtk_wdt_resume) -}; +static DEFINE_SIMPLE_DEV_PM_OPS(mtk_wdt_pm_ops, + mtk_wdt_suspend, mtk_wdt_resume); static struct platform_driver mtk_wdt_driver = { .probe = mtk_wdt_probe, .driver = { .name = DRV_NAME, - .pm = &mtk_wdt_pm_ops, + .pm = pm_sleep_ptr(&mtk_wdt_pm_ops), .of_match_table = mtk_wdt_dt_ids, }, }; From aa55761ab442f71cd4dded60f55bbd90a3c904af Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Tue, 28 Jun 2022 20:34:45 +0100 Subject: [PATCH 12/24] watchdog: s3c2410_wdt: Remove #ifdef guards for PM related functions Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. Not using #ifdef guards means that the code is always compiled independently of any Kconfig option, and thanks to that bugs and regressions are easier to catch. Signed-off-by: Paul Cercueil Cc: Krzysztof Kozlowski Cc: Alim Akhtar Cc: linux-arm-kernel@lists.infradead.org Cc: linux-samsung-soc@vger.kernel.org Reviewed-by: Krzysztof Kozlowski Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20220628193449.160585-5-paul@crapouillou.net Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck --- drivers/watchdog/s3c2410_wdt.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c index 6db22f2e3a4f..95919392927f 100644 --- a/drivers/watchdog/s3c2410_wdt.c +++ b/drivers/watchdog/s3c2410_wdt.c @@ -845,8 +845,6 @@ static void s3c2410wdt_shutdown(struct platform_device *dev) s3c2410wdt_stop(&wdt->wdt_device); } -#ifdef CONFIG_PM_SLEEP - static int s3c2410wdt_suspend(struct device *dev) { int ret; @@ -885,10 +883,9 @@ static int s3c2410wdt_resume(struct device *dev) return 0; } -#endif -static SIMPLE_DEV_PM_OPS(s3c2410wdt_pm_ops, s3c2410wdt_suspend, - s3c2410wdt_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(s3c2410wdt_pm_ops, + s3c2410wdt_suspend, s3c2410wdt_resume); static struct platform_driver s3c2410wdt_driver = { .probe = s3c2410wdt_probe, @@ -897,7 +894,7 @@ static struct platform_driver s3c2410wdt_driver = { .id_table = s3c2410_wdt_ids, .driver = { .name = "s3c2410-wdt", - .pm = &s3c2410wdt_pm_ops, + .pm = pm_sleep_ptr(&s3c2410wdt_pm_ops), .of_match_table = of_match_ptr(s3c2410_wdt_match), }, }; From 5c040ea210185ce20f780906acca8231efa333b6 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Tue, 28 Jun 2022 20:34:46 +0100 Subject: [PATCH 13/24] watchdog: sama5d4_wdt: Remove #ifdef guards for PM related functions Use the new LATE_SYSTEM_SLEEP_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. Not using #ifdef guards means that the code is always compiled independently of any Kconfig option, and thanks to that bugs and regressions are easier to catch. Signed-off-by: Paul Cercueil Cc: Nicolas Ferre Cc: Alexandre Belloni Cc: Claudiu Beznea Cc: linux-arm-kernel@lists.infradead.org Reviewed-by: Claudiu Beznea Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20220628193449.160585-6-paul@crapouillou.net Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck --- drivers/watchdog/sama5d4_wdt.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/watchdog/sama5d4_wdt.c b/drivers/watchdog/sama5d4_wdt.c index ec20ad4e534f..aeee934ca51b 100644 --- a/drivers/watchdog/sama5d4_wdt.c +++ b/drivers/watchdog/sama5d4_wdt.c @@ -339,7 +339,6 @@ static const struct of_device_id sama5d4_wdt_of_match[] = { }; MODULE_DEVICE_TABLE(of, sama5d4_wdt_of_match); -#ifdef CONFIG_PM_SLEEP static int sama5d4_wdt_suspend_late(struct device *dev) { struct sama5d4_wdt *wdt = dev_get_drvdata(dev); @@ -366,18 +365,17 @@ static int sama5d4_wdt_resume_early(struct device *dev) return 0; } -#endif static const struct dev_pm_ops sama5d4_wdt_pm_ops = { - SET_LATE_SYSTEM_SLEEP_PM_OPS(sama5d4_wdt_suspend_late, - sama5d4_wdt_resume_early) + LATE_SYSTEM_SLEEP_PM_OPS(sama5d4_wdt_suspend_late, + sama5d4_wdt_resume_early) }; static struct platform_driver sama5d4_wdt_driver = { .probe = sama5d4_wdt_probe, .driver = { .name = "sama5d4_wdt", - .pm = &sama5d4_wdt_pm_ops, + .pm = pm_sleep_ptr(&sama5d4_wdt_pm_ops), .of_match_table = sama5d4_wdt_of_match, } }; From 29958ab702817c4a977fd17852f4d58f5c8f5a52 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Tue, 28 Jun 2022 20:34:47 +0100 Subject: [PATCH 14/24] watchdog: st_lpc_wdt: Remove #ifdef guards for PM related functions Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. Not using #ifdef guards means that the code is always compiled independently of any Kconfig option, and thanks to that bugs and regressions are easier to catch. Signed-off-by: Paul Cercueil Cc: Patrice Chotard Cc: linux-arm-kernel@lists.infradead.org Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20220628193449.160585-7-paul@crapouillou.net Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck --- drivers/watchdog/st_lpc_wdt.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/watchdog/st_lpc_wdt.c b/drivers/watchdog/st_lpc_wdt.c index 14ab6559c748..39abecdb9dd1 100644 --- a/drivers/watchdog/st_lpc_wdt.c +++ b/drivers/watchdog/st_lpc_wdt.c @@ -248,7 +248,6 @@ static int st_wdog_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM_SLEEP static int st_wdog_suspend(struct device *dev) { struct st_wdog *st_wdog = watchdog_get_drvdata(&st_wdog_dev); @@ -285,16 +284,14 @@ static int st_wdog_resume(struct device *dev) return 0; } -#endif -static SIMPLE_DEV_PM_OPS(st_wdog_pm_ops, - st_wdog_suspend, - st_wdog_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(st_wdog_pm_ops, + st_wdog_suspend, st_wdog_resume); static struct platform_driver st_wdog_driver = { .driver = { .name = "st-lpc-wdt", - .pm = &st_wdog_pm_ops, + .pm = pm_sleep_ptr(&st_wdog_pm_ops), .of_match_table = st_wdog_match, }, .probe = st_wdog_probe, From c1eaa8c559684459eae981f8fad4973a0ac674a4 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Tue, 28 Jun 2022 20:34:48 +0100 Subject: [PATCH 15/24] watchdog: tegra_wdt: Remove #ifdef guards for PM related functions Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. Not using #ifdef guards means that the code is always compiled independently of any Kconfig option, and thanks to that bugs and regressions are easier to catch. While at it, the functions tegra_wdt_runtime_{suspend,resume} were renamed to tegra_wdt_{suspend,resume}, as they are *not* runtime-PM callbacks, but standard system suspend/resume callbacks. Signed-off-by: Paul Cercueil Cc: Thierry Reding Cc: Jonathan Hunter Cc: linux-tegra@vger.kernel.org Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20220628193449.160585-8-paul@crapouillou.net Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck --- drivers/watchdog/tegra_wdt.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/watchdog/tegra_wdt.c b/drivers/watchdog/tegra_wdt.c index dfe06e506cad..d5de6c0657a5 100644 --- a/drivers/watchdog/tegra_wdt.c +++ b/drivers/watchdog/tegra_wdt.c @@ -230,8 +230,7 @@ static int tegra_wdt_probe(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM_SLEEP -static int tegra_wdt_runtime_suspend(struct device *dev) +static int tegra_wdt_suspend(struct device *dev) { struct tegra_wdt *wdt = dev_get_drvdata(dev); @@ -241,7 +240,7 @@ static int tegra_wdt_runtime_suspend(struct device *dev) return 0; } -static int tegra_wdt_runtime_resume(struct device *dev) +static int tegra_wdt_resume(struct device *dev) { struct tegra_wdt *wdt = dev_get_drvdata(dev); @@ -250,7 +249,6 @@ static int tegra_wdt_runtime_resume(struct device *dev) return 0; } -#endif static const struct of_device_id tegra_wdt_of_match[] = { { .compatible = "nvidia,tegra30-timer", }, @@ -258,16 +256,14 @@ static const struct of_device_id tegra_wdt_of_match[] = { }; MODULE_DEVICE_TABLE(of, tegra_wdt_of_match); -static const struct dev_pm_ops tegra_wdt_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(tegra_wdt_runtime_suspend, - tegra_wdt_runtime_resume) -}; +static DEFINE_SIMPLE_DEV_PM_OPS(tegra_wdt_pm_ops, + tegra_wdt_suspend, tegra_wdt_resume); static struct platform_driver tegra_wdt_driver = { .probe = tegra_wdt_probe, .driver = { .name = "tegra-wdt", - .pm = &tegra_wdt_pm_ops, + .pm = pm_sleep_ptr(&tegra_wdt_pm_ops), .of_match_table = tegra_wdt_of_match, }, }; From 5f02d033f3a512397e2304c3cd0c0d69471e5338 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Tue, 28 Jun 2022 20:34:49 +0100 Subject: [PATCH 16/24] watchdog: wdat_wdt: Remove #ifdef guards for PM related functions Use the new NOIRQ_SYSTEM_SLEEP_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. Not using #ifdef guards means that the code is always compiled independently of any Kconfig option, and thanks to that bugs and regressions are easier to catch. Signed-off-by: Paul Cercueil Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20220628193449.160585-9-paul@crapouillou.net Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck --- drivers/watchdog/wdat_wdt.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/watchdog/wdat_wdt.c b/drivers/watchdog/wdat_wdt.c index e6f95e99156d..aeadaa07c891 100644 --- a/drivers/watchdog/wdat_wdt.c +++ b/drivers/watchdog/wdat_wdt.c @@ -467,7 +467,6 @@ static int wdat_wdt_probe(struct platform_device *pdev) return devm_watchdog_register_device(dev, &wdat->wdd); } -#ifdef CONFIG_PM_SLEEP static int wdat_wdt_suspend_noirq(struct device *dev) { struct wdat_wdt *wdat = dev_get_drvdata(dev); @@ -528,18 +527,16 @@ static int wdat_wdt_resume_noirq(struct device *dev) return wdat_wdt_start(&wdat->wdd); } -#endif static const struct dev_pm_ops wdat_wdt_pm_ops = { - SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(wdat_wdt_suspend_noirq, - wdat_wdt_resume_noirq) + NOIRQ_SYSTEM_SLEEP_PM_OPS(wdat_wdt_suspend_noirq, wdat_wdt_resume_noirq) }; static struct platform_driver wdat_wdt_driver = { .probe = wdat_wdt_probe, .driver = { .name = "wdat_wdt", - .pm = &wdat_wdt_pm_ops, + .pm = pm_sleep_ptr(&wdat_wdt_pm_ops), }, }; From 4e5b406514fce00b16b7fc8cc5a6c9ec51518b0a Mon Sep 17 00:00:00 2001 From: Stephan Gerhold Date: Wed, 29 Jun 2022 10:48:14 +0200 Subject: [PATCH 17/24] watchdog: pm8916_wdt: Avoid read of write-only PET register PMIC_WD_RESET_PET is a write-only register that is used to ping the watchdog. It does not make sense to use read-modify-write for it: a register read will never return anything but zero. (And actually even if it did we would still want to write again to ensure the watchdog is pinged.) Reduce the overhead for the watchdog ping slightly by using regmap_write() directly instead. Signed-off-by: Stephan Gerhold Reviewed-by: Loic Poulain Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20220629084816.125515-2-stephan.gerhold@kernkonzept.com Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck --- drivers/watchdog/pm8916_wdt.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/watchdog/pm8916_wdt.c b/drivers/watchdog/pm8916_wdt.c index 0937b8d33104..670cd79f4cf9 100644 --- a/drivers/watchdog/pm8916_wdt.c +++ b/drivers/watchdog/pm8916_wdt.c @@ -58,9 +58,8 @@ static int pm8916_wdt_ping(struct watchdog_device *wdev) { struct pm8916_wdt *wdt = watchdog_get_drvdata(wdev); - return regmap_update_bits(wdt->regmap, - wdt->baseaddr + PON_PMIC_WD_RESET_PET, - WATCHDOG_PET_BIT, WATCHDOG_PET_BIT); + return regmap_write(wdt->regmap, wdt->baseaddr + PON_PMIC_WD_RESET_PET, + WATCHDOG_PET_BIT); } static int pm8916_wdt_configure_timers(struct watchdog_device *wdev) From e7c54a412f49e9a9b8145d96a34ff3a06375dd43 Mon Sep 17 00:00:00 2001 From: Stephan Gerhold Date: Wed, 29 Jun 2022 10:48:15 +0200 Subject: [PATCH 18/24] watchdog: pm8916_wdt: Report reboot reason The PM8916 PMIC provides "power-off reason" (POFF_REASON) registers to allow detecting why the board was powered off or rebooted. This can be used to expose if a reset happened due to a watchdog timeout. The watchdog API also provides status bits for overtemperature and undervoltage which happen to be reported in the same PMIC register. Make this information available as part of the watchdog device so userspace can decide to handle the situation accordingly. Signed-off-by: Stephan Gerhold Reviewed-by: Loic Poulain Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20220629084816.125515-3-stephan.gerhold@kernkonzept.com Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck --- drivers/watchdog/pm8916_wdt.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/watchdog/pm8916_wdt.c b/drivers/watchdog/pm8916_wdt.c index 670cd79f4cf9..49f1a5204526 100644 --- a/drivers/watchdog/pm8916_wdt.c +++ b/drivers/watchdog/pm8916_wdt.c @@ -9,6 +9,12 @@ #include #include +#define PON_POFF_REASON1 0x0c +#define PON_POFF_REASON1_PMIC_WD BIT(2) +#define PON_POFF_REASON2 0x0d +#define PON_POFF_REASON2_UVLO BIT(5) +#define PON_POFF_REASON2_OTST3 BIT(6) + #define PON_INT_RT_STS 0x10 #define PMIC_WD_BARK_STS_BIT BIT(6) @@ -110,12 +116,14 @@ static irqreturn_t pm8916_wdt_isr(int irq, void *arg) } static const struct watchdog_info pm8916_wdt_ident = { - .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, + .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE | + WDIOF_OVERHEAT | WDIOF_CARDRESET | WDIOF_POWERUNDER, .identity = "QCOM PM8916 PON WDT", }; static const struct watchdog_info pm8916_wdt_pt_ident = { .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE | + WDIOF_OVERHEAT | WDIOF_CARDRESET | WDIOF_POWERUNDER | WDIOF_PRETIMEOUT, .identity = "QCOM PM8916 PON WDT", }; @@ -135,6 +143,7 @@ static int pm8916_wdt_probe(struct platform_device *pdev) struct pm8916_wdt *wdt; struct device *parent; int err, irq; + u8 poff[2]; wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); if (!wdt) @@ -175,6 +184,21 @@ static int pm8916_wdt_probe(struct platform_device *pdev) wdt->wdev.info = &pm8916_wdt_ident; } + err = regmap_bulk_read(wdt->regmap, wdt->baseaddr + PON_POFF_REASON1, + &poff, ARRAY_SIZE(poff)); + if (err) { + dev_err(dev, "failed to read POFF reason: %d\n", err); + return err; + } + + dev_dbg(dev, "POFF reason: %#x %#x\n", poff[0], poff[1]); + if (poff[0] & PON_POFF_REASON1_PMIC_WD) + wdt->wdev.bootstatus |= WDIOF_CARDRESET; + if (poff[1] & PON_POFF_REASON2_UVLO) + wdt->wdev.bootstatus |= WDIOF_POWERUNDER; + if (poff[1] & PON_POFF_REASON2_OTST3) + wdt->wdev.bootstatus |= WDIOF_OVERHEAT; + /* Configure watchdog to hard-reset mode */ err = regmap_write(wdt->regmap, wdt->baseaddr + PON_PMIC_WD_RESET_S2_CTL, From 066951ca33ced33f84a725214494df2ee8ad49bd Mon Sep 17 00:00:00 2001 From: Stephan Gerhold Date: Wed, 29 Jun 2022 10:48:16 +0200 Subject: [PATCH 19/24] watchdog: pm8916_wdt: Handle watchdog enabled by bootloader The bootloader might already enable the watchdog to catch hangs during the boot process. In that case the kernel needs to ping the watchdog temporarily until userspace is fully started. Add a check for this in the probe() function and set the WDOG_HW_RUNNING flag to make the watchdog core handle this automatically. Signed-off-by: Stephan Gerhold Reviewed-by: Loic Poulain Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20220629084816.125515-4-stephan.gerhold@kernkonzept.com Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck --- drivers/watchdog/pm8916_wdt.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/watchdog/pm8916_wdt.c b/drivers/watchdog/pm8916_wdt.c index 49f1a5204526..f4bfbffaf49c 100644 --- a/drivers/watchdog/pm8916_wdt.c +++ b/drivers/watchdog/pm8916_wdt.c @@ -142,6 +142,7 @@ static int pm8916_wdt_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct pm8916_wdt *wdt; struct device *parent; + unsigned int val; int err, irq; u8 poff[2]; @@ -199,6 +200,15 @@ static int pm8916_wdt_probe(struct platform_device *pdev) if (poff[1] & PON_POFF_REASON2_OTST3) wdt->wdev.bootstatus |= WDIOF_OVERHEAT; + err = regmap_read(wdt->regmap, wdt->baseaddr + PON_PMIC_WD_RESET_S2_CTL2, + &val); + if (err) { + dev_err(dev, "failed to check if watchdog is active: %d\n", err); + return err; + } + if (val & S2_RESET_EN_BIT) + set_bit(WDOG_HW_RUNNING, &wdt->wdev.status); + /* Configure watchdog to hard-reset mode */ err = regmap_write(wdt->regmap, wdt->baseaddr + PON_PMIC_WD_RESET_S2_CTL, From 1cdaa0d5f430a97ec9471dc2a65ab23fd913461b Mon Sep 17 00:00:00 2001 From: Luo Xueqin Date: Tue, 5 Jul 2022 23:31:38 +0800 Subject: [PATCH 20/24] watchdog:Fix typo in comment Spelling mistake in comment. Reported-by: k2ci Signed-off-by: Luo Xueqin Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20220705153138.29657-1-luoxueqin66@gmail.com Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck --- drivers/watchdog/pc87413_wdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/watchdog/pc87413_wdt.c b/drivers/watchdog/pc87413_wdt.c index 9f9a340427fc..c7f745caf203 100644 --- a/drivers/watchdog/pc87413_wdt.c +++ b/drivers/watchdog/pc87413_wdt.c @@ -442,7 +442,7 @@ static long pc87413_ioctl(struct file *file, unsigned int cmd, } } -/* -- Notifier funtions -----------------------------------------*/ +/* -- Notifier functions -----------------------------------------*/ /** * pc87413_notify_sys: From 60e1fba4310f92522a567749d1ba6e2421115d61 Mon Sep 17 00:00:00 2001 From: Abel Vesa Date: Thu, 7 Jul 2022 15:50:15 +0300 Subject: [PATCH 21/24] dt-bindings: watchdog: Add fsl,scu-wdt yaml file In order to replace the fsl,scu txt file from bindings/arm/freescale, we need to split it between the right subsystems. This patch documents separately the 'watchdog' child node of the SCU main node. Signed-off-by: Abel Vesa Signed-off-by: Viorel Suman Reviewed-by: Guenter Roeck Reviewed-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20220707125022.1156498-9-viorel.suman@oss.nxp.com Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck --- .../devicetree/bindings/arm/freescale/fsl,scu.txt | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/Documentation/devicetree/bindings/arm/freescale/fsl,scu.txt b/Documentation/devicetree/bindings/arm/freescale/fsl,scu.txt index a87ec15e28d2..8da63bfe8fa4 100644 --- a/Documentation/devicetree/bindings/arm/freescale/fsl,scu.txt +++ b/Documentation/devicetree/bindings/arm/freescale/fsl,scu.txt @@ -151,16 +151,6 @@ Optional Child nodes: - Data cells of ocotp: Detailed bindings are described in bindings/nvmem/nvmem.txt -Watchdog bindings based on SCU Message Protocol ------------------------------------------------------------- - -Required properties: -- compatible: should be: - "fsl,imx8qxp-sc-wdt" - followed by "fsl,imx-sc-wdt"; -Optional properties: -- timeout-sec: contains the watchdog timeout in seconds. - SCU key bindings based on SCU Message Protocol ------------------------------------------------------------ @@ -249,11 +239,6 @@ firmware { linux,keycodes = ; }; - watchdog { - compatible = "fsl,imx8qxp-sc-wdt", "fsl,imx-sc-wdt"; - timeout-sec = <60>; - }; - tsens: thermal-sensor { compatible = "fsl,imx8qxp-sc-thermal", "fsl,imx-sc-thermal"; #thermal-sensor-cells = <1>; From b79953090ab063fed67dbcb48a7e30be0db404f0 Mon Sep 17 00:00:00 2001 From: Jason Wang Date: Sat, 16 Jul 2022 12:18:56 +0800 Subject: [PATCH 22/24] watchdog: Fix comment typo The double `and' is duplicated in the comment, remove one. Signed-off-by: Jason Wang Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20220716041856.34449-1-wangborong@cdjrlc.com Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck --- drivers/watchdog/booke_wdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/watchdog/booke_wdt.c b/drivers/watchdog/booke_wdt.c index 5e4dc1a0f2c6..75da5cd02615 100644 --- a/drivers/watchdog/booke_wdt.c +++ b/drivers/watchdog/booke_wdt.c @@ -74,7 +74,7 @@ static unsigned long long period_to_sec(unsigned int period) /* * This procedure will find the highest period which will give a timeout * greater than the one required. e.g. for a bus speed of 66666666 and - * and a parameter of 2 secs, then this procedure will return a value of 38. + * a parameter of 2 secs, then this procedure will return a value of 38. */ static unsigned int sec_to_period(unsigned int secs) { From 30ebc985d1add0222ca37acb6fbf54b0ee79e9b1 Mon Sep 17 00:00:00 2001 From: Jason Wang Date: Sat, 16 Jul 2022 12:19:51 +0800 Subject: [PATCH 23/24] watchdog: dw_wdt: Fix comment typo The double `have' is duplicated in the comment, remove one. Signed-off-by: Jason Wang Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20220716041951.34714-1-wangborong@cdjrlc.com Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck --- drivers/watchdog/dw_wdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c index 060dae67d852..52962e8d11a6 100644 --- a/drivers/watchdog/dw_wdt.c +++ b/drivers/watchdog/dw_wdt.c @@ -218,7 +218,7 @@ static int dw_wdt_set_timeout(struct watchdog_device *wdd, unsigned int top_s) /* * Set the new value in the watchdog. Some versions of dw_wdt - * have have TOPINIT in the TIMEOUT_RANGE register (as per + * have TOPINIT in the TIMEOUT_RANGE register (as per * CP_WDT_DUAL_TOP in WDT_COMP_PARAMS_1). On those we * effectively get a pat of the watchdog right here. */ From 2d27e52841092e5831dd41f313028c668d816eb0 Mon Sep 17 00:00:00 2001 From: William Dean Date: Fri, 22 Jul 2022 11:09:38 +0800 Subject: [PATCH 24/24] 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 Signed-off-by: William Dean Reviewed-by: Marek Beh=C3=BAn Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20220722030938.2925156-1-williamsukatube@163.com Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck --- drivers/watchdog/armada_37xx_wdt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/watchdog/armada_37xx_wdt.c b/drivers/watchdog/armada_37xx_wdt.c index 1635f421ef2c..854b1cc723cb 100644 --- a/drivers/watchdog/armada_37xx_wdt.c +++ b/drivers/watchdog/armada_37xx_wdt.c @@ -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);