]> Gentwo Git Trees - linux/.git/commit
leds: netxbig: Fix GPIO descriptor leak in error paths
authorHaotian Zhang <vulab@iscas.ac.cn>
Fri, 31 Oct 2025 02:16:20 +0000 (10:16 +0800)
committerLee Jones <lee@kernel.org>
Thu, 13 Nov 2025 13:51:12 +0000 (13:51 +0000)
commit03865dd8af52eb16c38062df2ed30a91b604780e
treee38e393cb90843c2c8db4f3acf85ad7c5e09632b
parent434959618c47efe9e5f2e20f4a850caac4f6b823
leds: netxbig: Fix GPIO descriptor leak in error paths

The function netxbig_gpio_ext_get() acquires GPIO descriptors but
fails to release them when errors occur mid-way through initialization.
The cleanup callback registered by devm_add_action_or_reset() only
runs on success, leaving acquired GPIOs leaked on error paths.

Add goto-based error handling to release all acquired GPIOs before
returning errors.

Fixes: 9af512e81964 ("leds: netxbig: Convert to use GPIO descriptors")
Suggested-by: Markus Elfring <Markus.Elfring@web.de>
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
Link: https://patch.msgid.link/20251031021620.781-1-vulab@iscas.ac.cn
Signed-off-by: Lee Jones <lee@kernel.org>
drivers/leds/leds-netxbig.c