summaryrefslogtreecommitdiffstats
path: root/drivers/watchdog
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2016-02-19 09:18:43 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2016-02-23 08:14:16 +0100
commit8ee5479a28df0a3f3019419e46e9ee5c119a27bd (patch)
treeed1fb39fb0a39e89525581a1feeeede937556bb5 /drivers/watchdog
parentf1f8f5556ab94f4f8bedb97ad0199b2e63958c8b (diff)
downloadbarebox-8ee5479a28df0a3f3019419e46e9ee5c119a27bd.tar.gz
driver: Fix return check of dev_request_mem_region
dev_request_mem_region returns an ERR_PTR, fix places which check for a NULL pointer instead. This patch has been generated with this semantic patch, written by me and improved by Andrey Smirnov: // <smpl> @@ expression e; expression e1; @@ e = dev_request_mem_region(...); ... -if (!e) - return e1; +if (IS_ERR(e)) + return PTR_ERR(e); @ rule1 @ expression e; @@ e = dev_request_mem_region(...); @@ expression rule1.e; identifier ret, label; constant errno; @@ if (!e) { ... ( - ret = -errno; + ret = PTR_ERR(e); ... goto label; | - return -errno; + return PTR_ERR(e); ) } @depends on rule1@ expression rule1.e; @@ - if (e == NULL) + if (IS_ERR(e)) { ... } // </smpl> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Diffstat (limited to 'drivers/watchdog')
-rw-r--r--drivers/watchdog/imxwd.c4
-rw-r--r--drivers/watchdog/jz4740.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/drivers/watchdog/imxwd.c b/drivers/watchdog/imxwd.c
index 1952548..1458894 100644
--- a/drivers/watchdog/imxwd.c
+++ b/drivers/watchdog/imxwd.c
@@ -183,9 +183,9 @@ 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) {
+ if (IS_ERR(priv->base)) {
dev_err(dev, "could not get memory region\n");
- return -ENODEV;
+ return PTR_ERR(priv->base);
}
priv->ops = ops;
priv->wd.set_timeout = imx_watchdog_set_timeout;
diff --git a/drivers/watchdog/jz4740.c b/drivers/watchdog/jz4740.c
index 3d45b46..85a1c1d 100644
--- a/drivers/watchdog/jz4740.c
+++ b/drivers/watchdog/jz4740.c
@@ -71,9 +71,9 @@ static int jz4740_wdt_probe(struct device_d *dev)
priv = xzalloc(sizeof(struct jz4740_wdt_drvdata));
priv->base = dev_request_mem_region(dev, 0);
- if (!priv->base) {
+ if (IS_ERR(priv->base)) {
dev_err(dev, "could not get memory region\n");
- return -ENODEV;
+ return PTR_ERR(priv->base);
}
dev->priv = priv;