HomeFreeBSD

gpioc: cleanup if pin allocation fails

Description

gpioc: cleanup if pin allocation fails

gpioc normally depends on gpioc_cdevpriv_dtor to call
gpioc_release_pin_intr when it's done with a pin. However, if
gpioc_allocate_pin_intr fails, the pin is never added to the linked list
which the destructor loops over to free the pins. Make it so
gpioc_allocate_pin_intr cleans up after itself if it fails.

Reported by: Evgenii Ivanov <devivanov@proton.me>
Approved by: imp (mentor, implicit)
Differential Revision: https://reviews.freebsd.org/D51998

Details

Provenance
vexeduxrAuthored on Aug 27 2025, 9:25 PM
Differential Revision
D51998: gpioc: cleanup if pin allocation fails
Parents
rG39bdc7d19b1a: gpiobus: add pin_config_32 and pin_access_32
Branches
Unknown
Tags
Unknown