diff options
author | Geert Uytterhoeven <geert+renesas@glider.be> | 2020-01-10 14:19:21 +0100 |
---|---|---|
committer | Geert Uytterhoeven <geert+renesas@glider.be> | 2020-02-21 13:57:44 +0100 |
commit | a95b077db4fcf5aeeaf74372e31d684df29cb033 (patch) | |
tree | ff247de4f1f9c0265e92545b16ecee0e2768f2c2 /drivers/pinctrl/sh-pfc | |
parent | 4ef30dc72d0a3b3087078379b8e6d666a3c24270 (diff) | |
download | linux-a95b077db4fcf5aeeaf74372e31d684df29cb033.tar.bz2 |
pinctrl: sh-pfc: checker: Improve pin function checks
Improve the checks for pin function descriptors:
1. Merge declaration and assignment of the local variable for the
current pin function,
2. Pin function names must be unique.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Link: https://lore.kernel.org/r/20200110131927.1029-8-geert+renesas@glider.be
Diffstat (limited to 'drivers/pinctrl/sh-pfc')
-rw-r--r-- | drivers/pinctrl/sh-pfc/core.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/pinctrl/sh-pfc/core.c b/drivers/pinctrl/sh-pfc/core.c index be7afc48703d..fd649ab8ad1a 100644 --- a/drivers/pinctrl/sh-pfc/core.c +++ b/drivers/pinctrl/sh-pfc/core.c @@ -849,7 +849,6 @@ check_enum_ids: static void __init sh_pfc_check_info(const struct sh_pfc_soc_info *info) { - const struct sh_pfc_function *func; const char *drvname = info->name; unsigned int *refcnts; unsigned int i, j, k; @@ -890,11 +889,17 @@ static void __init sh_pfc_check_info(const struct sh_pfc_soc_info *info) return; for (i = 0; i < info->nr_functions; i++) { - func = &info->functions[i]; + const struct sh_pfc_function *func = &info->functions[i]; + if (!func->name) { sh_pfc_err("empty function %u\n", i); continue; } + for (j = 0; j < i; j++) { + if (same_name(func->name, info->functions[j].name)) + sh_pfc_err("function %s: name conflict\n", + func->name); + } for (j = 0; j < func->nr_groups; j++) { for (k = 0; k < info->nr_groups; k++) { if (same_name(func->groups[j], |