summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorFabio Estevam <fabio.estevam@nxp.com>2017-07-22 19:04:33 +0300
committerWim Van Sebroeck <wim@iguana.be>2017-09-09 21:50:35 +0300
commit15210ad18fcbd7f53f40e26e4391710d271c2daf (patch)
tree2708ced2eafdf1c3077bb4d45c1a7581dee5c44a /drivers
parent6f671c6b6288fd673e8b8b8acf1070100ba8188a (diff)
downloadlinux-15210ad18fcbd7f53f40e26e4391710d271c2daf.tar.xz
watchdog: qcom: Check for platform_get_resource() failure
platform_get_resource() may fail, so we should better check its return value and propagate an error in case it fails. This avoids a NULL pointer dereference a bit later in the code. Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/watchdog/qcom-wdt.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/watchdog/qcom-wdt.c b/drivers/watchdog/qcom-wdt.c
index 4f47b5e90956..780971318810 100644
--- a/drivers/watchdog/qcom-wdt.c
+++ b/drivers/watchdog/qcom-wdt.c
@@ -162,6 +162,8 @@ static int qcom_wdt_probe(struct platform_device *pdev)
return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!res)
+ return -ENOMEM;
/* We use CPU0's DGT for the watchdog */
if (of_property_read_u32(np, "cpu-offset", &percpu_offset))