]> git.proxmox.com Git - mirror_frr.git/commitdiff
nhrpd: clean up SA warning
authorMark Stapp <mjs@voltanet.io>
Thu, 17 Oct 2019 13:52:51 +0000 (09:52 -0400)
committerMark Stapp <mjs@voltanet.io>
Thu, 17 Oct 2019 20:08:47 +0000 (16:08 -0400)
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 <mjs@voltanet.io>
nhrpd/list.h
nhrpd/nhrpd.h

index 590d92560c3aec2526df7073e194302e36560adc..a43687ac089aed53e20375fdc622eb1c35ad40b9 100644 (file)
@@ -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
index ad38cad83bfed58a348fe17b202dc24a8b778305..cbee5951f30075c77d86b68aba1985999721952d 100644 (file)
@@ -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);
        }
 }