[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20211220061755.770193-1-jiasheng@iscas.ac.cn>
Date: Mon, 20 Dec 2021 14:17:55 +0800
From: Jiasheng Jiang <jiasheng@...as.ac.cn>
To: wim@...ux-watchdog.org, linux@...ck-us.net
Cc: linux-watchdog@...r.kernel.org, linux-kernel@...r.kernel.org,
Jiasheng Jiang <jiasheng@...as.ac.cn>
Subject: [PATCH] watchdog: ie6xx_wdt: Check for null res pointer
The return value of platform_get_resource() needs to be checked.
To avoid use of error pointer in case of the failure of alloc.
Fixes: 101ce87b3bdd ("watchdog: Add watchdog driver for Intel Atom E6XX")
Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
---
drivers/watchdog/ie6xx_wdt.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/watchdog/ie6xx_wdt.c b/drivers/watchdog/ie6xx_wdt.c
index 8f28993fab8b..ee5b68d2e271 100644
--- a/drivers/watchdog/ie6xx_wdt.c
+++ b/drivers/watchdog/ie6xx_wdt.c
@@ -271,6 +271,9 @@ static int ie6xx_wdt_remove(struct platform_device *pdev)
struct resource *res;
res = platform_get_resource(pdev, IORESOURCE_IO, 0);
+ if (!res)
+ return -EINVAL;
+
ie6xx_wdt_stop(NULL);
watchdog_unregister_device(&ie6xx_wdt_dev);
ie6xx_wdt_debugfs_exit();
--
2.25.1
Powered by blists - more mailing lists