Commit 40c8e4aa authored by Geert Uytterhoeven's avatar Geert Uytterhoeven

pinctrl: sh-pfc: checker: Improve pin group checks

Improve the checks for pin group descriptors:
  1. Introduce a local variable for the current group, to make the
     checks easier to read,
  2. Pin group names must be unique.
Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: default avatarNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Link: https://lore.kernel.org/r/20200110131927.1029-9-geert+renesas@glider.be
parent a95b077d
...@@ -916,15 +916,22 @@ static void __init sh_pfc_check_info(const struct sh_pfc_soc_info *info) ...@@ -916,15 +916,22 @@ static void __init sh_pfc_check_info(const struct sh_pfc_soc_info *info)
} }
for (i = 0; i < info->nr_groups; i++) { for (i = 0; i < info->nr_groups; i++) {
if (!info->groups[i].name) { const struct sh_pfc_pin_group *group = &info->groups[i];
if (!group->name) {
sh_pfc_err("empty group %u\n", i); sh_pfc_err("empty group %u\n", i);
continue; continue;
} }
for (j = 0; j < i; j++) {
if (same_name(group->name, info->groups[j].name))
sh_pfc_err("group %s: name conflict\n",
group->name);
}
if (!refcnts[i]) if (!refcnts[i])
sh_pfc_err("orphan group %s\n", info->groups[i].name); sh_pfc_err("orphan group %s\n", group->name);
else if (refcnts[i] > 1) else if (refcnts[i] > 1)
sh_pfc_warn("group %s referenced by %u functions\n", sh_pfc_warn("group %s referenced by %u functions\n",
info->groups[i].name, refcnts[i]); group->name, refcnts[i]);
} }
kfree(refcnts); kfree(refcnts);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment