diff options
author | 2023-12-09 19:21:44 -0800 | |
---|---|---|
committer | 2023-12-09 19:21:44 -0800 | |
commit | 99d4cf7659554c2c9c5e4c0808782759b7d32bbd (patch) | |
tree | 9daa2f980acfd458bed1beb90e615faceb9907e1 | |
parent | Merge tag 'usb-6.7-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb (diff) | |
parent | gpiolib: sysfs: Fix error handling on failed export (diff) | |
download | wireguard-linux-99d4cf7659554c2c9c5e4c0808782759b7d32bbd.tar.xz wireguard-linux-99d4cf7659554c2c9c5e4c0808782759b7d32bbd.zip |
Merge tag 'gpio-fixes-for-v6.7-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux
Pull gpio fix from Bartosz Golaszewski:
- fix an error path after a failed export in sysfs code
* tag 'gpio-fixes-for-v6.7-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux:
gpiolib: sysfs: Fix error handling on failed export
Diffstat (limited to '')
-rw-r--r-- | drivers/gpio/gpiolib-sysfs.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/gpio/gpiolib-sysfs.c b/drivers/gpio/gpiolib-sysfs.c index 6f309a3b2d9a..12d853845bb8 100644 --- a/drivers/gpio/gpiolib-sysfs.c +++ b/drivers/gpio/gpiolib-sysfs.c @@ -474,14 +474,17 @@ static ssize_t export_store(const struct class *class, goto done; status = gpiod_set_transitory(desc, false); - if (!status) { - status = gpiod_export(desc, true); - if (status < 0) - gpiod_free(desc); - else - set_bit(FLAG_SYSFS, &desc->flags); + if (status) { + gpiod_free(desc); + goto done; } + status = gpiod_export(desc, true); + if (status < 0) + gpiod_free(desc); + else + set_bit(FLAG_SYSFS, &desc->flags); + done: if (status) pr_debug("%s: status %d\n", __func__, status); |