Whamcloud - gitweb
LU-6142 libcfs: use list_first_entry() where appropriate. 29/50829/4
authorMr NeilBrown <neilb@suse.de>
Wed, 6 Nov 2019 22:48:25 +0000 (09:48 +1100)
committerOleg Drokin <green@whamcloud.com>
Wed, 31 May 2023 19:03:47 +0000 (19:03 +0000)
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 <neilb@suse.de>
Change-Id: Ib7ec3f3ab7f34afb3b39fda0ff9d916514b062ff
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50829
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
libcfs/libcfs/libcfs_string.c

index be88452..4bbff41 100644 (file)
@@ -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));
        }