kernel/pipe: squash compiler warning

The compiler complains that:

```
zephyr/kernel/include/kernel_internal.h:121:29:
error: 'reader' may be used uninitialized [-Werror=maybe-uninitialized]
  121 |         thread->swap_retval = value;
      |         ~~~~~~~~~~~~~~~~~~~~^~~~~~~
zephyr/kernel/pipe.c: In function 'copy_to_pending_readers':
zephyr/kernel/pipe.c:92:26: note: 'reader' was declared here
   92 |         struct k_thread *reader;
      |                          ^~~~~~
```

The static analyzer fails to see through the `LOCK_SCHED_SPINLOCK`
construct that the `reader` pointer is always initialized.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
This commit is contained in:
Nicolas Pitre 2025-01-21 21:02:07 -05:00 committed by Benjamin Cabé
commit f93c1ed291

View file

@ -89,7 +89,7 @@ struct pipe_buf_spec {
static size_t copy_to_pending_readers(struct k_pipe *pipe, bool *need_resched, static size_t copy_to_pending_readers(struct k_pipe *pipe, bool *need_resched,
const uint8_t *data, size_t len) const uint8_t *data, size_t len)
{ {
struct k_thread *reader; struct k_thread *reader = NULL;
struct pipe_buf_spec *reader_buf; struct pipe_buf_spec *reader_buf;
size_t copy_size, written = 0; size_t copy_size, written = 0;