summaryrefslogtreecommitdiff
path: root/drivers/pinctrl/sh-pfc
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert+renesas@glider.be>2020-01-10 14:19:20 +0100
committerGeert Uytterhoeven <geert+renesas@glider.be>2020-02-21 13:57:44 +0100
commit4ef30dc72d0a3b3087078379b8e6d666a3c24270 (patch)
tree2234dfede485b5076f590ebd404a111b996199ec /drivers/pinctrl/sh-pfc
parent12d057bad683b1c60476681ecc835c858018df60 (diff)
pinctrl: sh-pfc: checker: Improve pin checks
Improve the checks for pin descriptors: 1. Introduce local variables for the current pin, to make the checks easier to read, 2. Pins must have a name, 3. Fix double printing of identical pin names. 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-7-geert+renesas@glider.be
Diffstat (limited to 'drivers/pinctrl/sh-pfc')
-rw-r--r--drivers/pinctrl/sh-pfc/core.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/drivers/pinctrl/sh-pfc/core.c b/drivers/pinctrl/sh-pfc/core.c
index 6c6eb791f145..be7afc48703d 100644
--- a/drivers/pinctrl/sh-pfc/core.c
+++ b/drivers/pinctrl/sh-pfc/core.c
@@ -860,25 +860,27 @@ static void __init sh_pfc_check_info(const struct sh_pfc_soc_info *info)
/* Check pins */
for (i = 0; i < info->nr_pins; i++) {
+ const struct sh_pfc_pin *pin = &info->pins[i];
+
+ if (!pin->name) {
+ sh_pfc_err("empty pin %u\n", i);
+ continue;
+ }
for (j = 0; j < i; j++) {
- if (same_name(info->pins[i].name, info->pins[j].name))
- sh_pfc_err("pin %s/%s: name conflict\n",
- info->pins[i].name,
- info->pins[j].name);
+ const struct sh_pfc_pin *pin2 = &info->pins[j];
+
+ if (same_name(pin->name, pin2->name))
+ sh_pfc_err("pin %s: name conflict\n",
+ pin->name);
- if (info->pins[i].pin != (u16)-1 &&
- info->pins[i].pin == info->pins[j].pin)
+ if (pin->pin != (u16)-1 && pin->pin == pin2->pin)
sh_pfc_err("pin %s/%s: pin %u conflict\n",
- info->pins[i].name,
- info->pins[j].name,
- info->pins[i].pin);
+ pin->name, pin2->name, pin->pin);
- if (info->pins[i].enum_id &&
- info->pins[i].enum_id == info->pins[j].enum_id)
+ if (pin->enum_id && pin->enum_id == pin2->enum_id)
sh_pfc_err("pin %s/%s: enum_id %u conflict\n",
- info->pins[i].name,
- info->pins[j].name,
- info->pins[i].enum_id);
+ pin->name, pin2->name,
+ pin->enum_id);
}
}