aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/linux/gpio
diff options
context:
space:
mode:
authorLukas Wunner <lukas@wunner.de>2024-01-15 16:05:26 +0100
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>2024-01-15 18:41:29 +0100
commit832b371097eb928d077c827b8f117bf5b99d35c0 (patch)
treeda67fb5f889b1329c5f3abc74474b26f03d37b45 /include/linux/gpio
parentgpio: mlxbf3: add an error code check in mlxbf3_gpio_probe (diff)
downloadwireguard-linux-832b371097eb928d077c827b8f117bf5b99d35c0.tar.xz
wireguard-linux-832b371097eb928d077c827b8f117bf5b99d35c0.zip
gpiolib: Fix scope-based gpio_device refcounting
Commit 9e4555d1e54a ("gpiolib: add support for scope-based management to gpio_device") sought to add scope-based gpio_device refcounting, but erroneously forgot a negation of IS_ERR_OR_NULL(). As a result, gpio_device_put() is not called if the gpio_device pointer is valid (meaning the ref is leaked), but only called if the pointer is NULL or an ERR_PTR(). While at it drop a superfluous trailing semicolon. Fixes: 9e4555d1e54a ("gpiolib: add support for scope-based management to gpio_device") Signed-off-by: Lukas Wunner <lukas@wunner.de> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Diffstat (limited to 'include/linux/gpio')
-rw-r--r--include/linux/gpio/driver.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index e846bd4e7559..9a5c6c76e653 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -635,7 +635,7 @@ struct gpio_device *gpio_device_get(struct gpio_device *gdev);
void gpio_device_put(struct gpio_device *gdev);
DEFINE_FREE(gpio_device_put, struct gpio_device *,
- if (IS_ERR_OR_NULL(_T)) gpio_device_put(_T));
+ if (!IS_ERR_OR_NULL(_T)) gpio_device_put(_T))
struct device *gpio_device_to_device(struct gpio_device *gdev);