struct da9052_regulator_info *info;
int i;
- if (chip_id == DA9052) {
+ switch (chip_id) {
+ case DA9052:
for (i = 0; i < ARRAY_SIZE(da9052_regulator_info); i++) {
info = &da9052_regulator_info[i];
if (info->reg_desc.id == id)
return info;
}
- } else {
+ break;
+ case DA9053_AA:
+ case DA9053_BA:
+ case DA9053_BB:
for (i = 0; i < ARRAY_SIZE(da9053_regulator_info); i++) {
info = &da9053_regulator_info[i];
if (info->reg_desc.id == id)
return info;
}
+ break;
}
return NULL;
struct da9052_pdata *pdata;
int ret;
- regulator = kzalloc(sizeof(struct da9052_regulator), GFP_KERNEL);
+ regulator = devm_kzalloc(&pdev->dev, sizeof(struct da9052_regulator),
+ GFP_KERNEL);
if (!regulator)
return -ENOMEM;
return 0;
err:
- kfree(regulator);
+ devm_kfree(&pdev->dev, regulator);
return ret;
}
struct da9052_regulator *regulator = platform_get_drvdata(pdev);
regulator_unregister(regulator->rdev);
- kfree(regulator);
+ devm_kfree(&pdev->dev, regulator);
return 0;
}