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:37:13 +0200
commite7ff3d97e5c5f3146b636a5152f7ab0d12d3741b (patch)
tree32db0f44281a5c50d6d11255961d77768c1ad449
parent3bc3bbf7d27762f3985dcb1285bb6ed0598f2fee (diff)
downloadhikey-clang-android-hikey-linaro-4.4-clang.tar.gz
Fix for compilation with clangandroid-hikey-linaro-4.4-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)