Skip to content

Commit 832b371

Browse files
l1kBartosz Golaszewski
authored andcommitted
gpiolib: Fix scope-based gpio_device refcounting
Commit 9e4555d ("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: 9e4555d ("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>
1 parent d460e9c commit 832b371

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

include/linux/gpio/driver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ struct gpio_device *gpio_device_get(struct gpio_device *gdev);
635635
void gpio_device_put(struct gpio_device *gdev);
636636

637637
DEFINE_FREE(gpio_device_put, struct gpio_device *,
638-
if (IS_ERR_OR_NULL(_T)) gpio_device_put(_T));
638+
if (!IS_ERR_OR_NULL(_T)) gpio_device_put(_T))
639639

640640
struct device *gpio_device_to_device(struct gpio_device *gdev);
641641

0 commit comments

Comments
 (0)