Skip to content

Commit 005a4d8

Browse files
finikorgfabiobaltieri
authored andcommitted
gpio: Fix gpio_manage_callback() logic
gpio_manage_callback() returns -EINVAL if it could not remove callback. However if the list is empty success is returned when trying to remove callback. Signed-off-by: Andrei Emeltchenko <[email protected]>
1 parent a7537f5 commit 005a4d8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/gpio/gpio_utils.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ static inline int gpio_manage_callback(sys_slist_t *callbacks,
5151
return -EINVAL;
5252
}
5353
}
54+
} else if (!set) {
55+
return -EINVAL;
5456
}
5557

5658
if (set) {

0 commit comments

Comments
 (0)