Commit 15210ad1 authored by Fabio Estevam's avatar Fabio Estevam Committed by Wim Van Sebroeck

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: default avatarFabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarWim Van Sebroeck <wim@iguana.be>
parent 6f671c6b
...@@ -162,6 +162,8 @@ static int qcom_wdt_probe(struct platform_device *pdev) ...@@ -162,6 +162,8 @@ static int qcom_wdt_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res)
return -ENOMEM;
/* We use CPU0's DGT for the watchdog */ /* We use CPU0's DGT for the watchdog */
if (of_property_read_u32(np, "cpu-offset", &percpu_offset)) if (of_property_read_u32(np, "cpu-offset", &percpu_offset))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment