summaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl
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/pinctrl
parentf1f8f5556ab94f4f8bedb97ad0199b2e63958c8b (diff)
downloadbarebox-8ee5479a28df0a3f3019419e46e9ee5c119a27bd.tar.gz
barebox-8ee5479a28df0a3f3019419e46e9ee5c119a27bd.tar.xz
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/pinctrl')
-rw-r--r--drivers/pinctrl/mvebu/armada-370.c4
-rw-r--r--drivers/pinctrl/mvebu/dove.c6
2 files changed, 6 insertions, 4 deletions
diff --git a/drivers/pinctrl/mvebu/armada-370.c b/drivers/pinctrl/mvebu/armada-370.c
index b7901f8c6d..7ad8d04308 100644
--- a/drivers/pinctrl/mvebu/armada-370.c
+++ b/drivers/pinctrl/mvebu/armada-370.c
@@ -397,8 +397,8 @@ static int armada_370_pinctrl_probe(struct device_d *dev)
(struct mvebu_pinctrl_soc_info *)match->data;
mpp_base = dev_request_mem_region(dev, 0);
- if (!mpp_base)
- return -EBUSY;
+ if (IS_ERR(mpp_base))
+ return PTR_ERR(mpp_base);
return mvebu_pinctrl_probe(dev, soc);
}
diff --git a/drivers/pinctrl/mvebu/dove.c b/drivers/pinctrl/mvebu/dove.c
index d1848a79d3..6e0ce84d72 100644
--- a/drivers/pinctrl/mvebu/dove.c
+++ b/drivers/pinctrl/mvebu/dove.c
@@ -707,9 +707,11 @@ static int dove_pinctrl_probe(struct device_d *dev)
clk_enable(clk);
mpp_base = dev_request_mem_region(dev, 0);
+ if (IS_ERR(mpp_base))
+ return PTR_ERR(mpp_base);
mpp4_base = dev_request_mem_region(dev, 1);
- if (!mpp_base || !mpp4_base)
- return -EBUSY;
+ if (IS_ERR(mpp4_base))
+ return PTR_ERR(mpp4_base);
/*
* Dove PMU does not have a stable binding, yet.