From 77afee8ae97ae1a44597b0639c53833b5a370375 Mon Sep 17 00:00:00 2001 From: Mr NeilBrown Date: Thu, 7 Nov 2019 09:48:25 +1100 Subject: [PATCH] LU-6142 libcfs: use list_first_entry() where appropriate. This patch changes list_entry(foo.next, ...) to list_first_entry(&foo, ...) in cases where 'foo' is a list head, rather than a list member. It also re-indents following lines where that is needed. Test-Parameters: trivial Signed-off-by: Mr NeilBrown Change-Id: Ib7ec3f3ab7f34afb3b39fda0ff9d916514b062ff Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50829 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Arshad Hussain Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- libcfs/libcfs/libcfs_string.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libcfs/libcfs/libcfs_string.c b/libcfs/libcfs/libcfs_string.c index be88452..4bbff41 100644 --- a/libcfs/libcfs/libcfs_string.c +++ b/libcfs/libcfs/libcfs_string.c @@ -469,8 +469,8 @@ cfs_expr_list_free(struct cfs_expr_list *expr_list) while (!list_empty(&expr_list->el_exprs)) { struct cfs_range_expr *expr; - expr = list_entry(expr_list->el_exprs.next, - struct cfs_range_expr, re_link); + expr = list_first_entry(&expr_list->el_exprs, + struct cfs_range_expr, re_link); list_del(&expr->re_link); LIBCFS_FREE(expr, sizeof(*expr)); } -- 1.8.3.1