pinctrl: sirf: atlas7: Add missing 'of_node_put()'
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Tue, 20 Dec 2016 05:40:43 +0000 (06:40 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Fri, 30 Dec 2016 08:14:19 +0000 (09:14 +0100)
Reference to 'sys2pci_np' should be dropped in all cases here, not only in
error handling path.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/sirf/pinctrl-atlas7.c

index 7f3041697813ebc73bd031454dbb5df3ca30bb2d..f714f67c4b64cdf89d8d291f44ec40e63ccb76e2 100644 (file)
@@ -5420,14 +5420,15 @@ static int atlas7_pinmux_probe(struct platform_device *pdev)
        sys2pci_np = of_find_node_by_name(NULL, "sys2pci");
        if (!sys2pci_np)
                return -EINVAL;
+
        ret = of_address_to_resource(sys2pci_np, 0, &res);
+       of_node_put(sys2pci_np);
        if (ret)
                return ret;
+
        pmx->sys2pci_base = devm_ioremap_resource(&pdev->dev, &res);
-       if (IS_ERR(pmx->sys2pci_base)) {
-               of_node_put(sys2pci_np);
+       if (IS_ERR(pmx->sys2pci_base))
                return -ENOMEM;
-       }
 
        pmx->dev = &pdev->dev;