summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--nhrpd/list.h8
-rw-r--r--nhrpd/nhrpd.h3
2 files changed, 6 insertions, 5 deletions
diff --git a/nhrpd/list.h b/nhrpd/list.h
index 590d92560..a43687ac0 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 ad38cad83..cbee5951f 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);
}
}