summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert+renesas@glider.be>2021-12-23 15:28:20 +0100
committerGeert Uytterhoeven <geert+renesas@glider.be>2022-02-22 09:55:56 +0100
commitefe80cdfabe15b9d51d5eca8f88ab3a89b49a768 (patch)
tree788140c59c9e18eb912203dcb48c1e31a8c98a86
parent2e08ab0427fe3e33a92a37cfe3b6db340ab7397f (diff)
downloadlinux-efe80cdfabe15b9d51d5eca8f88ab3a89b49a768.tar.bz2
pinctrl: renesas: r8a7794: Add range checking to .pin_to_pocctrl()
The .pin_to_pocctrl() implementation for R-Car E2 does not perform a full range check, unlike on all other SoCs. Add the range check, so the checker can validate better the consistency of the pin control tables. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/r/d23767ad7152327654192d7191f4b8ae19493966.1640269510.git.geert+renesas@glider.be
-rw-r--r--drivers/pinctrl/renesas/pfc-r8a7794.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/pinctrl/renesas/pfc-r8a7794.c b/drivers/pinctrl/renesas/pfc-r8a7794.c
index fbb5b3b68f34..08a4269565e2 100644
--- a/drivers/pinctrl/renesas/pfc-r8a7794.c
+++ b/drivers/pinctrl/renesas/pfc-r8a7794.c
@@ -5623,6 +5623,9 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = {
static int r8a7794_pin_to_pocctrl(struct sh_pfc *pfc, unsigned int pin, u32 *pocctrl)
{
+ if (pin < RCAR_GP_PIN(6, 0) || pin > RCAR_GP_PIN(6, 23))
+ return -EINVAL;
+
*pocctrl = 0xe606006c;
switch (pin & 0x1f) {