return matched;
pdata->regulators = devm_kzalloc(dev,
- sizeof(struct act8865_regulator_data) * matched,
- GFP_KERNEL);
+ sizeof(struct act8865_regulator_data) *
+ ARRAY_SIZE(act8865_matches), GFP_KERNEL);
if (!pdata->regulators) {
dev_err(dev, "%s: failed to allocate act8865 registor\n",
__func__);
pdata->num_regulators = matched;
regulator = pdata->regulators;
- for (i = 0; i < matched; i++) {
- if (!act8865_matches[i].init_data)
- continue;
-
+ for (i = 0; i < ARRAY_SIZE(act8865_matches); i++) {
regulator->id = i;
regulator->name = act8865_matches[i].name;
regulator->platform_data = act8865_matches[i].init_data;
}
/* Finally register devices */
- for (i = 0; i < pdata->num_regulators; i++) {
+ for (i = 0; i < ARRAY_SIZE(act8865_matches); i++) {
id = pdata->regulators[i].id;