diff options
author | Dong Fang <yp.fangdong@gmail.com> | 2013-09-11 17:19:50 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-11 18:56:36 -0400 |
commit | df53cd3b70712cd136f10ef79457623c5c3764a4 (patch) | |
tree | 426988282de0ac3ff6d00a51dc8f299e47dfeefc /fs/ocfs2/cluster | |
parent | 8dd7903e48df3779bc424196c22dc73b66d0643e (diff) |
ocfs2: use list_for_each_entry() instead of list_for_each()
[dan.carpenter@oracle.com: fix up some NULL dereference bugs]
Signed-off-by: Dong Fang <yp.fangdong@gmail.com>
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Jeff Liu <jeff.liu@oracle.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ocfs2/cluster')
-rw-r--r-- | fs/ocfs2/cluster/heartbeat.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c index 5c1c864e81cc..25b72e82b8fa 100644 --- a/fs/ocfs2/cluster/heartbeat.c +++ b/fs/ocfs2/cluster/heartbeat.c | |||
@@ -628,11 +628,9 @@ static void o2hb_fire_callbacks(struct o2hb_callback *hbcall, | |||
628 | struct o2nm_node *node, | 628 | struct o2nm_node *node, |
629 | int idx) | 629 | int idx) |
630 | { | 630 | { |
631 | struct list_head *iter; | ||
632 | struct o2hb_callback_func *f; | 631 | struct o2hb_callback_func *f; |
633 | 632 | ||
634 | list_for_each(iter, &hbcall->list) { | 633 | list_for_each_entry(f, &hbcall->list, hc_item) { |
635 | f = list_entry(iter, struct o2hb_callback_func, hc_item); | ||
636 | mlog(ML_HEARTBEAT, "calling funcs %p\n", f); | 634 | mlog(ML_HEARTBEAT, "calling funcs %p\n", f); |
637 | (f->hc_func)(node, idx, f->hc_data); | 635 | (f->hc_func)(node, idx, f->hc_data); |
638 | } | 636 | } |
@@ -2516,8 +2514,7 @@ unlock: | |||
2516 | int o2hb_register_callback(const char *region_uuid, | 2514 | int o2hb_register_callback(const char *region_uuid, |
2517 | struct o2hb_callback_func *hc) | 2515 | struct o2hb_callback_func *hc) |
2518 | { | 2516 | { |
2519 | struct o2hb_callback_func *tmp; | 2517 | struct o2hb_callback_func *f; |
2520 | struct list_head *iter; | ||
2521 | struct o2hb_callback *hbcall; | 2518 | struct o2hb_callback *hbcall; |
2522 | int ret; | 2519 | int ret; |
2523 | 2520 | ||
@@ -2540,10 +2537,9 @@ int o2hb_register_callback(const char *region_uuid, | |||
2540 | 2537 | ||
2541 | down_write(&o2hb_callback_sem); | 2538 | down_write(&o2hb_callback_sem); |
2542 | 2539 | ||
2543 | list_for_each(iter, &hbcall->list) { | 2540 | list_for_each_entry(f, &hbcall->list, hc_item) { |
2544 | tmp = list_entry(iter, struct o2hb_callback_func, hc_item); | 2541 | if (hc->hc_priority < f->hc_priority) { |
2545 | if (hc->hc_priority < tmp->hc_priority) { | 2542 | list_add_tail(&hc->hc_item, &f->hc_item); |
2546 | list_add_tail(&hc->hc_item, iter); | ||
2547 | break; | 2543 | break; |
2548 | } | 2544 | } |
2549 | } | 2545 | } |