Add of_node_put to decrement the ref count.

Signed-off-by: Sachin Kamat <sachin.ka...@linaro.org>
---
 drivers/regulator/max77693.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/regulator/max77693.c b/drivers/regulator/max77693.c
index 057d040e6feb..d6807fd7eadc 100644
--- a/drivers/regulator/max77693.c
+++ b/drivers/regulator/max77693.c
@@ -176,13 +176,16 @@ static int max77693_pmic_dt_parse_rdata(struct device 
*dev,
 
        rmatch = devm_kzalloc(dev,
                 sizeof(*rmatch) * ARRAY_SIZE(regulators), GFP_KERNEL);
-       if (!rmatch)
+       if (!rmatch) {
+               of_node_put(np);
                return -ENOMEM;
+       }
 
        for (i = 0; i < ARRAY_SIZE(regulators); i++)
                rmatch[i].name = regulators[i].name;
 
        matched = of_regulator_match(dev, np, rmatch, ARRAY_SIZE(regulators));
+       of_node_put(np);
        if (matched <= 0)
                return matched;
        *rdata = devm_kzalloc(dev, sizeof(**rdata) * matched, GFP_KERNEL);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to