Skip to content

Commit

Permalink
kfifo: fix sparse complaints
Browse files Browse the repository at this point in the history
This patch fix complaints by the sparse tool when using kfifo_put() with
non scalar types like structures (i.e.
drivers/iio/industrialio-event.c).

Casting a pointer to the value and read this pointer instead of directly
casting the value will fix this.

The generated code is equal.

Signed-off-by: Stefani Seibold <stefani@seibold.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Stefani Seibold authored and Linus Torvalds committed Mar 22, 2016
1 parent ad4db3b commit 21b2f44
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/linux/kfifo.h
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ __kfifo_int_must_check_helper( \
((typeof(__tmp->type))__kfifo->data) : \
(__tmp->buf) \
)[__kfifo->in & __tmp->kfifo.mask] = \
(typeof(*__tmp->type))__val; \
*(typeof(__tmp->type))&__val; \
smp_wmb(); \
__kfifo->in++; \
} \
Expand Down

0 comments on commit 21b2f44

Please sign in to comment.