Merge branch 'work.sparc32' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[linux-2.6-microblaze.git] / drivers / regulator / s5m8767.c
index 3fa4721..7c111bb 100644 (file)
@@ -544,14 +544,18 @@ static int s5m8767_pmic_dt_parse_pdata(struct platform_device *pdev,
        rdata = devm_kcalloc(&pdev->dev,
                             pdata->num_regulators, sizeof(*rdata),
                             GFP_KERNEL);
-       if (!rdata)
+       if (!rdata) {
+               of_node_put(regulators_np);
                return -ENOMEM;
+       }
 
        rmode = devm_kcalloc(&pdev->dev,
                             pdata->num_regulators, sizeof(*rmode),
                             GFP_KERNEL);
-       if (!rmode)
+       if (!rmode) {
+               of_node_put(regulators_np);
                return -ENOMEM;
+       }
 
        pdata->regulators = rdata;
        pdata->opmode = rmode;
@@ -573,10 +577,13 @@ static int s5m8767_pmic_dt_parse_pdata(struct platform_device *pdev,
                        "s5m8767,pmic-ext-control",
                        GPIOD_OUT_HIGH | GPIOD_FLAGS_BIT_NONEXCLUSIVE,
                        "s5m8767");
-               if (PTR_ERR(rdata->ext_control_gpiod) == -ENOENT)
+               if (PTR_ERR(rdata->ext_control_gpiod) == -ENOENT) {
                        rdata->ext_control_gpiod = NULL;
-               else if (IS_ERR(rdata->ext_control_gpiod))
+               } else if (IS_ERR(rdata->ext_control_gpiod)) {
+                       of_node_put(reg_np);
+                       of_node_put(regulators_np);
                        return PTR_ERR(rdata->ext_control_gpiod);
+               }
 
                rdata->id = i;
                rdata->initdata = of_get_regulator_init_data(