diff options
author | Fabio Estevam <fabio.estevam@nxp.com> | 2017-07-22 18:04:33 +0200 |
---|---|---|
committer | Wim Van Sebroeck <wim@iguana.be> | 2017-09-09 20:50:35 +0200 |
commit | 15210ad18fcbd7f53f40e26e4391710d271c2daf (patch) | |
tree | 2708ced2eafdf1c3077bb4d45c1a7581dee5c44a /drivers/watchdog | |
parent | watchdog: of_xilinx_wdt: Add suspend/resume support (diff) | |
download | linux-15210ad18fcbd7f53f40e26e4391710d271c2daf.tar.xz linux-15210ad18fcbd7f53f40e26e4391710d271c2daf.zip |
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/watchdog')
-rw-r--r-- | drivers/watchdog/qcom-wdt.c | 2 |
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)) |