Skip to content

Commit

Permalink
kernel: poll: Allow 0 event input
Browse files Browse the repository at this point in the history
Allow caller to supply 0 events in which case the function just
does the sleep. This is useful so that the caller does not need
to create artificial events.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
  • Loading branch information
jukkar authored and andrewboie committed Jan 3, 2020
1 parent ac09bb3 commit cc6317d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kernel/poll.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ int z_impl_k_poll(struct k_poll_event *events, int num_events, s32_t timeout)

__ASSERT(!arch_is_in_isr(), "");
__ASSERT(events != NULL, "NULL events\n");
__ASSERT(num_events > 0, "zero events\n");
__ASSERT(num_events >= 0, "<0 events\n");

events_registered = register_events(events, num_events, &poller,
(timeout == K_NO_WAIT));
Expand Down Expand Up @@ -311,7 +311,7 @@ static inline int z_vrfy_k_poll(struct k_poll_event *events,
/* Validate the events buffer and make a copy of it in an
* allocated kernel-side buffer.
*/
if (Z_SYSCALL_VERIFY(num_events > 0)) {
if (Z_SYSCALL_VERIFY(num_events >= 0)) {
ret = -EINVAL;
goto out;
}
Expand Down

0 comments on commit cc6317d

Please sign in to comment.