diff options
| author | Quentin Young <qlyoung@users.noreply.github.com> | 2019-10-18 13:16:02 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-10-18 13:16:02 -0400 |
| commit | 757c868b4b734a1cbefb008e327f658082bb6dae (patch) | |
| tree | 517248216bd402aec4b879f8e2c8b13876d089e7 | |
| parent | dfd7b62ddd50b267255aa1ae40b31965f9c1e411 (diff) | |
| parent | 123ea351a42cce1b5e84b4f6b7e1bc33d3b05086 (diff) | |
Merge pull request #5180 from mjstapp/fix_nhrp_sa
nhrpd: clean up SA warning
| -rw-r--r-- | nhrpd/list.h | 8 | ||||
| -rw-r--r-- | nhrpd/nhrpd.h | 3 |
2 files changed, 6 insertions, 5 deletions
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 ad38cad83b..cbee5951f3 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); } } |
