]> git.ipfire.org Git - thirdparty/linux.git/commit
gpio: shared: don't allocate the lookup table until we really need it
authorBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Tue, 6 Jan 2026 09:34:23 +0000 (10:34 +0100)
committerBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Wed, 7 Jan 2026 08:31:14 +0000 (09:31 +0100)
commita80208072df8f4ceb53cd905c1f4362f84ce397f
treeefd681b1c36364a1ef93b1fe78cd39e99591df5a
parent476e44d06fc107f8cd99695d8e4f1c792dfc3379
gpio: shared: don't allocate the lookup table until we really need it

We allocate memory for the GPIO lookup table at the top of
gpio_shared_add_proxy_lookup() but we don't use it until the very end.
Depending on the timing, we may return earlier. Move the allocation
towards the end.

Fixes: a060b8c511ab ("gpiolib: implement low-level, shared GPIO support")
Tested-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20260106-gpio-shared-fixes-v2-3-c7091d2f7581@oss.qualcomm.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
drivers/gpio/gpiolib-shared.c