aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/pinctrl/freescale
diff options
context:
space:
mode:
authorVladimir Zapolskiy <vz@mleia.com>2016-03-09 02:45:36 +0200
committerLinus Walleij <linus.walleij@linaro.org>2016-03-30 10:57:52 +0200
commit9a4f424531dabd877259ae0071b8bcc4dede9eb5 (patch)
treebe0a10359a0d1672f1c1459e5a944e74d14ab3e5 /drivers/pinctrl/freescale
parentpinctrl: sunxi: Fix A33 external interrupts not working (diff)
downloadwireguard-linux-9a4f424531dabd877259ae0071b8bcc4dede9eb5.tar.xz
wireguard-linux-9a4f424531dabd877259ae0071b8bcc4dede9eb5.zip
pinctrl: freescale: imx: fix bogus check of of_iomap() return value
On error path of_iomap() returns NULL, hence IS_ERR() check is invalid and may cause a NULL pointer dereference, the change fixes this problem. While we are here invert a device node check to simplify the code. Fixes: 26d8cde5260b ("pinctrl: freescale: imx: add shared input select reg support") Signed-off-by: Vladimir Zapolskiy <vz@mleia.com> Acked-by: Shawn Guo <shawnguo@kernel.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/freescale')
-rw-r--r--drivers/pinctrl/freescale/pinctrl-imx.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c
index 46210512d8ec..9cfa544072b5 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx.c
@@ -762,19 +762,18 @@ int imx_pinctrl_probe(struct platform_device *pdev,
if (of_property_read_bool(dev_np, "fsl,input-sel")) {
np = of_parse_phandle(dev_np, "fsl,input-sel", 0);
- if (np) {
- ipctl->input_sel_base = of_iomap(np, 0);
- if (IS_ERR(ipctl->input_sel_base)) {
- of_node_put(np);
- dev_err(&pdev->dev,
- "iomuxc input select base address not found\n");
- return PTR_ERR(ipctl->input_sel_base);
- }
- } else {
+ if (!np) {
dev_err(&pdev->dev, "iomuxc fsl,input-sel property not found\n");
return -EINVAL;
}
+
+ ipctl->input_sel_base = of_iomap(np, 0);
of_node_put(np);
+ if (!ipctl->input_sel_base) {
+ dev_err(&pdev->dev,
+ "iomuxc input select base address not found\n");
+ return -ENOMEM;
+ }
}
imx_pinctrl_desc.name = dev_name(&pdev->dev);