if (!init_data)
return -EINVAL;
- tps = kzalloc(sizeof(*tps), GFP_KERNEL);
+ tps = devm_kzalloc(&pdev->dev, sizeof(*tps), GFP_KERNEL);
if (!tps)
return -ENOMEM;
fail:
while (--i >= 0)
regulator_unregister(tps->rdev[i]);
-
- kfree(tps);
return error;
}
for (i = 0; i < TPS6507X_NUM_REGULATOR; i++)
regulator_unregister(tps->rdev[i]);
-
- kfree(tps);
-
return 0;
}
hw->rdev[i] = NULL;
}
spi_set_drvdata(spi, NULL);
- kfree(hw);
return 0;
}
return -EINVAL;
}
- hw = kzalloc(sizeof(struct tps6524x), GFP_KERNEL);
+ hw = devm_kzalloc(&spi->dev, sizeof(struct tps6524x), GFP_KERNEL);
if (!hw) {
dev_err(dev, "cannot allocate regulator private data\n");
return -ENOMEM;
if (!pmic_plat_data)
return -EINVAL;
- pmic = kzalloc(sizeof(*pmic), GFP_KERNEL);
+ pmic = devm_kzalloc(&pdev->dev, sizeof(*pmic), GFP_KERNEL);
if (!pmic)
return -ENOMEM;
break;
default:
pr_err("Invalid tps chip version\n");
- kfree(pmic);
return -ENODEV;
}
sizeof(struct regulator_desc), GFP_KERNEL);
if (!pmic->desc) {
err = -ENOMEM;
- goto err_free_pmic;
+ goto err_out;
}
pmic->info = kcalloc(pmic->num_regulators,
kfree(pmic->info);
err_free_desc:
kfree(pmic->desc);
-err_free_pmic:
- kfree(pmic);
+err_out:
return err;
}
kfree(pmic->rdev);
kfree(pmic->info);
kfree(pmic->desc);
- kfree(pmic);
return 0;
}
reg_data = pmic_plat_data->tps65912_pmic_init_data;
- pmic = kzalloc(sizeof(*pmic), GFP_KERNEL);
+ pmic = devm_kzalloc(&pdev->dev, sizeof(*pmic), GFP_KERNEL);
if (!pmic)
return -ENOMEM;
err:
while (--i >= 0)
regulator_unregister(pmic->rdev[i]);
-
- kfree(pmic);
return err;
}
for (i = 0; i < TPS65912_NUM_REGULATOR; i++)
regulator_unregister(tps65912_reg->rdev[i]);
-
- kfree(tps65912_reg);
return 0;
}