lkml.org 
[lkml]   [2021]   [Dec]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2] watchdog: ie6xx_wdt: Check for null res pointer
Date
The return value of platform_get_resource() needs to be checked.
To avoid use of error pointer in case that there is no suitable resource.

Fixes: 101ce87b3bdd ("watchdog: Add watchdog driver for Intel Atom E6XX")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
Changelog:

v1 -> v2

*Change 1. Correct the commit message.
---
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
\
 
 \ /
  Last update: 2021-12-20 07:22    [W:0.069 / U:1.868 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site