gpio: shared: check if a reference is populated before cleaning its resources
authorBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Sat, 6 Dec 2025 11:53:54 +0000 (12:53 +0100)
committerBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Tue, 9 Dec 2025 06:16:45 +0000 (07:16 +0100)
commitc904a0d8525d5f03529ae3176e99bd32466ece7b
tree7032d309b06b0b13272a72ad93e4a5813e0a0f9e
parente2c4175b8d3b3ea65fc3801c190bd93fe8b7a7a9
gpio: shared: check if a reference is populated before cleaning its resources

It's possible that not all proxy entries will be set up when the device
gets removed so check if they are before trying to dereference members
which are still NULL. This can happen if some consumers never requested
their shared GPIOs.

Fixes: a060b8c511ab ("gpiolib: implement low-level, shared GPIO support")
Link: https://lore.kernel.org/r/20251206-gpio-shared-teardown-fixes-v1-2-35ac458cfce1@oss.qualcomm.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
drivers/gpio/gpiolib-shared.c