linux-stable/drivers/pinctrl
Andre Przywara d1dee81416 pinctrl: sunxi: Don't underestimate number of functions
When we are building all the various pinctrl structures for the
Allwinner pinctrl devices, we do some estimation about the maximum
number of distinct function (names) that we will need.

So far we take the number of pins as an upper bound, even though we
can actually have up to four special functions per pin. This wasn't a
problem until now, since we indeed have typically far more pins than
functions, and most pins share common functions.

However the H616 "-r" pin controller has only two pins, but four
functions, so we run over the end of the array when we are looking for
a matching function name in sunxi_pinctrl_add_function - there is no
NULL sentinel left that would terminate the loop:

[    8.200648] Unable to handle kernel paging request at virtual address fffdff7efbefaff5
[    8.209179] Mem abort info:
....
[    8.368456] Call trace:
[    8.370925]  __pi_strcmp+0x90/0xf0
[    8.374559]  sun50i_h616_r_pinctrl_probe+0x1c/0x28
[    8.379557]  platform_probe+0x68/0xd8

Do an actual worst case allocation (4 functions per pin, three common
functions and the sentinel) for the initial array allocation. This is
now heavily overestimating the number of functions in the common case,
but we will reallocate this array later with the actual number of
functions, so it's only temporarily.

Fixes: 561c1cf17c ("pinctrl: sunxi: Add support for the Allwinner H616-R pin controller")
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime@cerno.tech>
Link: https://lore.kernel.org/r/20210722132548.22121-1-andre.przywara@arm.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2021-08-10 14:55:35 +02:00
..
actions pinctrl: actions: Add depends on || COMPILE_TEST 2021-02-12 13:44:26 +01:00
aspeed This is the bulk of pin control changes for the v5.14 kernel: 2021-07-01 16:57:14 -07:00
bcm pinctrl: bcm: Constify static pinmux_ops 2021-06-09 11:18:33 +02:00
berlin
cirrus
freescale pinctrl: imx: Disallow driver unbind 2021-04-08 16:00:53 +02:00
intel pinctrl: tigerlake: Add Alder Lake-M ACPI ID 2021-05-25 16:26:38 +03:00
mediatek pinctrl: mediatek: Fix fallback behavior for bias_set_combo 2021-07-23 17:41:56 +02:00
meson pinctrl/meson: enable building as modules 2020-11-05 14:51:38 +01:00
mvebu pinctrl: armada-cp110 - fix MPP54/MPP55 functions 2021-03-10 14:41:12 +01:00
nomadik pinctrl: nomadik: Remove unused variable in nmk_gpio_dbg_show_one 2021-01-06 00:20:14 +01:00
nuvoton pinctrl: npcm: Align a few entries in the pin function table 2021-05-25 17:10:05 +02:00
pxa pinctrl: Introduce MODE group in enum pin_config_param 2021-04-22 02:03:01 +02:00
qcom pinctrl: qcom: fix GPIOLIB dependencies 2021-07-23 11:51:19 +02:00
ralink This is the bulk of pin control changes for the v5.14 kernel: 2021-07-01 16:57:14 -07:00
renesas pinctrl: renesas: r8a77980: Add bias pinconf support 2021-05-31 10:50:29 +02:00
samsung pinctrl: samsung: use 'int' for register masks in Exynos 2021-04-10 02:06:36 +02:00
spear pinctrl/spear: simplify the return expression of spear300_pinctrl_probe() 2020-12-12 01:42:06 +01:00
sprd pinctrl: sprd: Simplify bool comparison 2021-01-18 14:41:42 +01:00
stm32 This is the bulk of pin control changes for the v5.14 kernel: 2021-07-01 16:57:14 -07:00
sunxi pinctrl: sunxi: Don't underestimate number of functions 2021-08-10 14:55:35 +02:00
tegra
ti pinctrl: ti: fix error return code of ti_iodelay_dt_node_to_map() 2021-04-08 15:57:14 +02:00
uniphier
visconti gpio: visconti: Add Toshiba Visconti GPIO support 2021-02-15 11:43:26 +01:00
vt8500
core.c This is the bulk of the pin control changes for the v5.13 kernel cycle 2021-04-30 13:04:30 -07:00
core.h
devicetree.c
devicetree.h
Kconfig pinctrl: zynqmp: some code cleanups 2021-06-26 01:44:19 +02:00
Makefile pinctrl: Add Xilinx ZynqMP pinctrl driver support 2021-04-22 11:13:04 +02:00
pinconf-generic.c pinctrl: Introduce MODE group in enum pin_config_param 2021-04-22 02:03:01 +02:00
pinconf.c pinctrl: use to octal permissions for debugfs files 2021-03-10 14:41:58 +01:00
pinconf.h
pinctrl-amd.c pinctrl/amd: Add device HID for new AMD GPIO controller 2021-05-25 17:09:48 +02:00
pinctrl-amd.h pinctrl: amd: Add missing pins to the pin group list 2020-10-07 15:37:17 +02:00
pinctrl-artpec6.c
pinctrl-as3722.c
pinctrl-at91-pio4.c pinctrl: at91-pio4: Fix slew rate disablement 2021-04-13 09:42:18 +02:00
pinctrl-at91.c pinctrl: at91: Constify struct at91_pinctrl_mux_ops 2021-05-25 17:10:05 +02:00
pinctrl-at91.h
pinctrl-axp209.c
pinctrl-bm1880.c
pinctrl-da850-pupd.c
pinctrl-da9062.c
pinctrl-digicolor.c
pinctrl-equilibrium.c pinctrl: equilibrium: Add missing MODULE_DEVICE_TABLE 2021-05-20 01:00:24 +02:00
pinctrl-equilibrium.h
pinctrl-falcon.c pinctrl: falcon: add missing put_device() call in pinctrl_falcon_probe() 2020-12-04 09:17:51 +01:00
pinctrl-gemini.c
pinctrl-ingenic.c linux/kconfig.h: replace IF_ENABLED() with PTR_IF() in <linux/kernel.h> 2021-05-09 00:29:45 +09:00
pinctrl-k210.c drivers: pinctrl: Remove duplicate include of io.h 2021-03-30 00:54:37 +02:00
pinctrl-lantiq.c
pinctrl-lantiq.h
pinctrl-lpc18xx.c pinctrl: Introduce MODE group in enum pin_config_param 2021-04-22 02:03:01 +02:00
pinctrl-max77620.c
pinctrl-mcp23s08.c pinctrl: mcp23s08: Add optional reset GPIO 2021-06-12 01:58:10 +02:00
pinctrl-mcp23s08.h pinctrl: mcp23s08: Add optional reset GPIO 2021-06-12 01:58:10 +02:00
pinctrl-mcp23s08_i2c.c
pinctrl-mcp23s08_spi.c pinctrl: mcp23s08: Print error message when regmap init fails 2020-11-05 11:30:31 +01:00
pinctrl-microchip-sgpio.c pinctrl: microchip-sgpio: Put fwnode in error case during ->probe() 2021-06-18 11:17:47 +02:00
pinctrl-ocelot.c pinctrl: ocelot: Remove redundant error printing in ocelot_pinctrl_probe() 2021-05-20 01:33:53 +02:00
pinctrl-oxnas.c
pinctrl-palmas.c
pinctrl-pic32.c
pinctrl-pic32.h
pinctrl-pistachio.c
pinctrl-rk805.c
pinctrl-rockchip.c This is the bulk of the pin control changes for the v5.13 kernel cycle 2021-04-30 13:04:30 -07:00
pinctrl-single.c pinctrl: single: config: enable the pin's input 2021-06-07 09:02:27 +02:00
pinctrl-st.c pinctrl: remove empty lines in pinctrl subsystem 2021-01-05 16:09:24 +01:00
pinctrl-stmfx.c
pinctrl-sx150x.c pinctrl: remove empty lines in pinctrl subsystem 2021-01-05 16:09:24 +01:00
pinctrl-tb10x.c
pinctrl-utils.c pinctrl: use krealloc_array() 2020-12-15 12:13:37 -08:00
pinctrl-utils.h
pinctrl-xway.c
pinctrl-zynq.c pinctrl: Introduce MODE group in enum pin_config_param 2021-04-22 02:03:01 +02:00
pinctrl-zynqmp.c pinctrl: zynqmp: some code cleanups 2021-06-26 01:44:19 +02:00
pinmux.c pinctrl: pinmux: Add pinmux-select debugfs file 2021-03-10 14:41:58 +01:00
pinmux.h