soc/tegra: pmc: Add missing of_node_put()
authorJon Hunter <jonathanh@nvidia.com>
Tue, 28 Jun 2016 10:38:27 +0000 (11:38 +0100)
committerThierry Reding <treding@nvidia.com>
Thu, 30 Jun 2016 10:23:08 +0000 (12:23 +0200)
Add missing of_node_put() in PMC early initialisation function to avoid
leaking the device nodes.

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
[treding@nvidia.com: squash in a couple more of_node_put() calls]
Signed-off-by: Thierry Reding <treding@nvidia.com>
drivers/soc/tegra/pmc.c

index 483d54623ec5282de19bffde3b44296de2800dc5..48e1de2f7aeb8e6809c33a6ddf17e588a03c50e0 100644 (file)
@@ -1540,6 +1540,7 @@ static int __init tegra_pmc_early_init(void)
                 */
                if (of_address_to_resource(np, 0, &regs) < 0) {
                        pr_err("failed to get PMC registers\n");
+                       of_node_put(np);
                        return -ENXIO;
                }
        }
@@ -1547,6 +1548,7 @@ static int __init tegra_pmc_early_init(void)
        pmc->base = ioremap_nocache(regs.start, resource_size(&regs));
        if (!pmc->base) {
                pr_err("failed to map PMC registers\n");
+               of_node_put(np);
                return -ENXIO;
        }
 
@@ -1572,6 +1574,8 @@ static int __init tegra_pmc_early_init(void)
                        value &= ~PMC_CNTRL_INTR_POLARITY;
 
                tegra_pmc_writel(value, PMC_CNTRL);
+
+               of_node_put(np);
        }
 
        return 0;