+ /* count the # of VFEs which have flagged power-domain */[...]
Personal peeve, but this comment seems a bit excessive
+ for (vfepd_num = i = 0; i < camss->vfe_total_num; i++) {the last 3 words seem out of place
+ if (res->vfe_res[i].has_pd)
+ vfepd_num++;
+ }
- camss->genpd_link = devm_kmalloc_array(dev, camss->genpd_num,
- sizeof(*camss->genpd_link),
- GFP_KERNEL);
- if (!camss->genpd_link)
- return -ENOMEM;
+ /*
+ * If the number of power-domains is greater than the number of VFEs
+ * then the additional power-domain is for the entire CAMSS block the
+ * 'top' power-domain.
+ */if (!(camss->genpd_num > vfepd_num))
+ if (camss->genpd_num <= vfepd_num)
+ return 0;
would probably be easier to follow given your comment above