linux/drivers/pinctrl
Josh Poimboeuf 323deebaa2 pinctrl: ingenic: Improve unreachable code generation
[ Upstream commit d6d43a9217 ]

In the second loop of ingenic_pinconf_set(), it annotates the switch
default case as unreachable().  The annotation is technically correct,
because that same case would have resulted in an early function return
in the previous loop.

However, the compiled code is suboptimal.  GCC seems to work extra hard
to ensure that the unreachable code path triggers undefined behavior.
The function would fall through to start executing whatever function
happens to be next in the compilation unit.

This is problematic because:

  a) it adds unnecessary 'ensure undefined behavior' logic, and
     corresponding i-cache footprint; and

  b) it's less robust -- if a bug were to be introduced, falling through
     to the next function would be catastrophic.

Yet another issue is that, while objtool normally understands
unreachable() annotations, there's one special case where it doesn't:
when the annotation occurs immediately after a 'ret' instruction.  That
happens to be the case here because unreachable() is immediately before
the return.

Remove the unreachable() annotation and replace it with a comment.  This
simplifies the code generation and changes the unreachable error path to
just silently return instead of corrupting execution.

This fixes the following objtool warning:

  drivers/pinctrl/pinctrl-ingenic.o: warning: objtool: ingenic_pinconf_set() falls through to next function ingenic_pinconf_group_set()

Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Link: https://lore.kernel.org/r/bc20fdbcb826512cf76b7dfd0972740875931b19.1582212881.git.jpoimboe@redhat.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-05-22 11:38:27 +02:00
..
actions
aspeed pinctrl: aspeed: g6: Fix PWMG0 pinctrl setting 2021-01-27 11:47:47 +01:00
bcm pinctrl: bcm: fix kconfig dependency warning when !GPIOLIB 2020-10-29 09:57:34 +01:00
berlin
cirrus
freescale pinctrl: freescale: imx: Fix an error handling path in 'imx_pinctrl_probe()' 2020-06-24 17:50:38 +02:00
intel pinctrl: lewisburg: Update number of pins in community 2021-04-28 13:19:14 +02:00
mediatek
meson pinctrl: meson-gxl: fix GPIOX sdio pins 2020-03-18 07:17:55 +01:00
mvebu pinctrl: mvebu: Fix i2c sda definition for 98DX3236 2020-10-07 08:01:28 +02:00
nomadik
nuvoton
pxa
qcom pinctrl: qcom: spmi-gpio: fix warning about irq chip reusage 2020-06-30 15:37:04 -04:00
samsung pinctrl: samsung: use 'int' for register masks in Exynos 2021-05-19 10:08:22 +02:00
sh-pfc pinctrl: sh-pfc: sh7269: Fix CAN function GPIOs 2020-02-24 08:36:41 +01:00
sirf
spear
sprd
stm32
sunxi pinctrl: sunxi: Always call chained_irq_{enter, exit} in sunxi_pinctrl_irq_handler 2020-12-30 11:51:45 +01:00
tegra pinctrl: tegra: Use noirq suspend/resume callbacks 2020-06-30 15:37:04 -04:00
ti
uniphier
vt8500
zte
Kconfig
Makefile
core.c pinctrl: core: Remove extra kref_get which blocks hogs being freed 2020-03-18 07:17:55 +01:00
core.h
devicetree.c
devicetree.h
pinconf-generic.c
pinconf.c
pinconf.h
pinctrl-amd.c pinctrl: amd: remove debounce filter setting in IRQ type setting 2020-12-16 10:56:58 +01:00
pinctrl-amd.h pinctrl: amd: fix npins for uart0 in kerncz_groups 2020-07-29 10:18:26 +02:00
pinctrl-artpec6.c
pinctrl-as3722.c
pinctrl-at91-pio4.c
pinctrl-at91.c
pinctrl-at91.h
pinctrl-axp209.c
pinctrl-bm1880.c
pinctrl-coh901.c
pinctrl-coh901.h
pinctrl-da850-pupd.c
pinctrl-digicolor.c
pinctrl-falcon.c pinctrl: falcon: add missing put_device() call in pinctrl_falcon_probe() 2020-12-30 11:51:18 +01:00
pinctrl-gemini.c
pinctrl-ingenic.c pinctrl: ingenic: Improve unreachable code generation 2021-05-22 11:38:27 +02:00
pinctrl-lantiq.c
pinctrl-lantiq.h
pinctrl-lpc18xx.c
pinctrl-max77620.c
pinctrl-mcp23s08.c pinctrl: mcp23s08: Fix mcp23x17 precious range 2020-10-29 09:57:39 +01:00
pinctrl-ocelot.c pinctrl: ocelot: Fix GPIO interrupt decoding on Jaguar2 2020-06-24 17:50:14 +02:00
pinctrl-oxnas.c
pinctrl-palmas.c
pinctrl-pic32.c
pinctrl-pic32.h
pinctrl-pistachio.c
pinctrl-rk805.c
pinctrl-rockchip.c pinctrl: rockchip: fix restore error in resume 2021-04-07 14:47:43 +02:00
pinctrl-rza1.c pinctrl: rza1: Fix wrong array assignment of rza1l_swio_entries 2020-06-24 17:50:21 +02:00
pinctrl-rza2.c
pinctrl-rzn1.c
pinctrl-single.c pinctrl-single: fix pcs_parse_pinconf() return value 2020-08-19 08:16:21 +02:00
pinctrl-st.c
pinctrl-stmfx.c
pinctrl-sx150x.c
pinctrl-tb10x.c
pinctrl-u300.c
pinctrl-utils.c
pinctrl-utils.h
pinctrl-xway.c
pinctrl-zynq.c
pinmux.c
pinmux.h