aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Rosenkränzer <bero@linaro.org>2017-06-07 15:36:08 +0200
committerBernhard Rosenkränzer <bero@linaro.org>2017-06-07 15:36:08 +0200
commit4f3c3c1e7b153e333603be74d786d79bb872e8ff (patch)
tree9ccd8f84446aa8679f07fec6f4a8a25764971a1b
parent4f73e80e8d11ce625e50f258cf687afe2bd32d77 (diff)
downloadhikey-clang-4f3c3c1e7b153e333603be74d786d79bb872e8ff.tar.gz
Fix for compilation with clangandroid-hikey-linaro-4.9-clang
The clang compiler treats the memory address of a structure field as tautologically true when compared to non-NULL. This breaks the macros in llist.h when compiled using clang. Fix this by not comparing the address of a structure field to NULL when determining the end of the llist. Refer to -Wtautological-pointer-compare in clang for more information. Signed-off-by: Hans Petter Selasky <hps@selasky.org> Signed-off-by: Bernhard Rosenkränzer <bero@linaro.org>
-rw-r--r--include/linux/llist.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/llist.h b/include/linux/llist.h
index fd4ca0b4fe0f..c8091a34d042 100644
--- a/include/linux/llist.h
+++ b/include/linux/llist.h
@@ -121,7 +121,7 @@ static inline void init_llist_head(struct llist_head *list)
*/
#define llist_for_each_entry(pos, node, member) \
for ((pos) = llist_entry((node), typeof(*(pos)), member); \
- &(pos)->member != NULL; \
+ (pos) != llist_entry(NULL, typeof(*(pos)), member); \
(pos) = llist_entry((pos)->member.next, typeof(*(pos)), member))
/**
@@ -143,7 +143,7 @@ static inline void init_llist_head(struct llist_head *list)
*/
#define llist_for_each_entry_safe(pos, n, node, member) \
for (pos = llist_entry((node), typeof(*pos), member); \
- &pos->member != NULL && \
+ (pos) != llist_entry(NULL, typeof(*(pos)), member) && \
(n = llist_entry(pos->member.next, typeof(*n), member), true); \
pos = n)