lkml.org 
[lkml]   [2022]   [Mar]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] ocfs2: fix check if list iterator did find an element
On Mon, Mar 21, 2022 at 02:34:34PM +0100, Jakob Koschel wrote:
> >> @@ -556,11 +556,11 @@ static void *lockres_seq_start(struct seq_file *m, loff_t *pos)
> >> }
> >> }
> >>
> >> - list_for_each_entry(res, track_list, tracking) {
> >> - if (&res->tracking == &dlm->tracking_list)
> >> - res = NULL;
> >> - else
> >> - dlm_lockres_get(res);
> >> + list_for_each_entry(iter, track_list, tracking) {
> >> + if (&iter->tracking != &dlm->tracking_list) {

This is an open coded version of:

if (!list_entry_is_head(iter, &dlm->tracking_list, tracking)) {

Ideally someone would come through with enough confidence to just delete
it but the second best option is to just make it readable...

regards,
dan carpenter

> >> + dlm_lockres_get(iter);
> >> + res = iter;
> >> + }
> >> break;
> >> }

\
 
 \ /
  Last update: 2022-03-21 14:59    [W:0.381 / U:0.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site