From: Mark Stapp Date: Thu, 17 Oct 2019 13:52:51 +0000 (-0400) Subject: nhrpd: clean up SA warning X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=84bb117859469bda0a79a359cc6565f2f49ffb35;p=matthieu%2Ffrr.git nhrpd: clean up SA warning Try to signal to SA/clang more clearly to clean up an SA warning in the nhrp-specific linkedlist code. Signed-off-by: Mark Stapp --- diff --git a/nhrpd/list.h b/nhrpd/list.h index 590d92560c..a43687ac08 100644 --- a/nhrpd/list.h +++ b/nhrpd/list.h @@ -198,10 +198,12 @@ static inline int list_empty(const struct list_head *n) pos = list_entry(pos->member.next, typeof(*pos), member)) #define list_for_each_entry_safe(pos, n, head, member) \ - for (pos = list_entry((head)->next, typeof(*pos), member), \ - n = (&pos->member != (head) ? \ + for (pos = ((head)->next != head ? \ + list_entry((head)->next, typeof(*pos), member) : \ + NULL), \ + n = (pos ? \ list_entry(pos->member.next, typeof(*pos), member) : NULL); \ - &pos->member != (head); \ + pos && (&pos->member != (head)); \ pos = n, n = list_entry(n->member.next, typeof(*n), member)) #endif diff --git a/nhrpd/nhrpd.h b/nhrpd/nhrpd.h index d09a6f5970..c9ed05ee1e 100644 --- a/nhrpd/nhrpd.h +++ b/nhrpd/nhrpd.h @@ -77,8 +77,7 @@ static inline void notifier_call(struct notifier_list *l, int cmd) { struct notifier_block *n, *nn; list_for_each_entry_safe(n, nn, &l->notifier_head, notifier_entry) { - if (n) - n->action(n, cmd); + n->action(n, cmd); } }