[PATCH v2 2/2] watchdog: i.MX: check requested mem region in imx_wd_probe()

Antony Pavlov antonynpavlov at gmail.com
Thu Jul 31 08:11:32 PDT 2014


Signed-off-by: Antony Pavlov <antonynpavlov at gmail.com>
---
 drivers/watchdog/imxwd.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/watchdog/imxwd.c b/drivers/watchdog/imxwd.c
index 63c5605..31c3d0d 100644
--- a/drivers/watchdog/imxwd.c
+++ b/drivers/watchdog/imxwd.c
@@ -159,6 +159,10 @@ static int imx_wd_probe(struct device_d *dev)
 
 	priv = xzalloc(sizeof(struct imx_wd));
 	priv->base = dev_request_mem_region(dev, 0);
+	if (!priv->base) {
+		dev_err(dev, "could not get memory region\n");
+		return -ENODEV;
+	}
 	priv->set_timeout = fn;
 	priv->wd.set_timeout = imx_watchdog_set_timeout;
 	priv->dev = dev;
-- 
2.0.1




More information about the barebox mailing list