From nobody Mon Jun 22 14:26:09 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF63EC433F5 for ; Tue, 22 Mar 2022 10:50:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233553AbiCVKwP (ORCPT ); Tue, 22 Mar 2022 06:52:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232589AbiCVKwO (ORCPT ); Tue, 22 Mar 2022 06:52:14 -0400 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08C5F811AB for ; Tue, 22 Mar 2022 03:50:43 -0700 (PDT) Received: by mail-ed1-x52e.google.com with SMTP id r23so21219579edb.0 for ; Tue, 22 Mar 2022 03:50:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=mYTrYht6AUVnHXQusTG11+67vE+GSz/eL3E7YG6g+Pw=; b=ANKaLn6pxoQ7ntAGRfscx+nhCUuIQg6KGgHc2SLz7Nw9rUbFNwcBqrrTqoF/VBnJcs 8Wz6ufDb9jeQ9sNpCa5Nr8MhwBeMGvmMPk2aFVRKaPNVj4E5Vm+m/Wg9NjHvlVoK/Hk5 f/O+f44s2o9PE3kWaZTYJWCb7oy0ZasIcJYhtS95dmdVshVkdRphmeSdvWLPn3f0TWp4 IvFu0B+FeH5Mt74hp7eoeRs3uo9jUeMaB4NF1HzaGVXiEs+q4KEV6GKuf7TqRwhsvelg IY2pXwWgLE8MrzcciduF87125OQ29cHzLMy9G/M5gE6/jSwtl8LjqZHPAWiqSDGokhmK dQog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=mYTrYht6AUVnHXQusTG11+67vE+GSz/eL3E7YG6g+Pw=; b=WK7T51Q8tY3YgJF4E4FSZ+QNQKq9+qT4uWX4dAEE3UyxssXT0Z059hpCOYC/UEOL4c t9e2ukSzNxTtN+8L3ag6HIx0oUjnCiUT1IUbgZs+begQJr1K6pth9pZXJPSyclpqBqzg 8NfoSaVQOOYS19iWiFogyNYLRfLVtEzdUTrUSu0dY+KaWJSMRBk8YLdaPv4j4Dy4i3Vf htqKhmdy/iGU+xxll8K5CPwpOwc3tX54f62fR9BZDnBlc07sj/RXZE+GdsBa6HGW0V24 ZhdBH0aXo+LitYa+4HUBaOWJGbTpp3mSHnJE2wMva3iPIRYSknynbkChwZp06sqLzlSv Ng/w== X-Gm-Message-State: AOAM533dMaeNAIEJTicIpYdAp/qKPyjSddn/HbqJ8DNb47GwMVuyYa5T ARI7tgATHEBUAiCH8qos+gg= X-Google-Smtp-Source: ABdhPJyEZZAgxNy2fD1bE8J9IveKSflMCMIFwxeBJptbSFj6LuDNtRfI8Wb4aBiasqcTiCr3z2aJRw== X-Received: by 2002:a05:6402:cac:b0:410:a920:4e90 with SMTP id cn12-20020a0564020cac00b00410a9204e90mr27660444edb.60.1647946241469; Tue, 22 Mar 2022 03:50:41 -0700 (PDT) Received: from localhost.localdomain (i130160.upc-i.chello.nl. [62.195.130.160]) by smtp.googlemail.com with ESMTPSA id e6-20020a056402190600b00413d03ac4a2sm7419629edz.69.2022.03.22.03.50.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Mar 2022 03:50:41 -0700 (PDT) From: Jakob Koschel To: Mark Fasheh Cc: Jakob Koschel , linux-kernel@vger.kernel.org, ocfs2-devel@oss.oracle.com, Joel Becker , Joseph Qi , Miguel Ojeda , Geert Uytterhoeven , Masahiro Yamada , Andrew Morton , Mike Rapoport , "Brian Johannesmeyer" , Cristiano Giuffrida , "Bos, H.J." Subject: [PATCH v2] ocfs2: remove usage of list iterator variable after the loop body Date: Tue, 22 Mar 2022 11:50:14 +0100 Message-Id: <20220322105014.3626194-1-jakobkoschel@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" To move the list iterator variable into the list_for_each_entry_*() macro in the future it should be avoided to use the list iterator variable after the loop body. To *never* use the list iterator variable after the loop it was concluded to use a separate iterator variable [1]. Link: https://lore.kernel.org/all/CAHk-=3DwgRr_D8CB-D9Kg-c=3DEHreAsk5SqXPwr= 9Y7k9sA6cWXJ6w@mail.gmail.com/ Signed-off-by: Jakob Koschel Reviewed-by: Joseph Qi --- fs/ocfs2/dlm/dlmdebug.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/ocfs2/dlm/dlmdebug.c b/fs/ocfs2/dlm/dlmdebug.c index d442cf5dda8a..be5e9ed7da8d 100644 --- a/fs/ocfs2/dlm/dlmdebug.c +++ b/fs/ocfs2/dlm/dlmdebug.c @@ -541,7 +541,7 @@ static void *lockres_seq_start(struct seq_file *m, loff= _t *pos) struct debug_lockres *dl =3D m->private; struct dlm_ctxt *dlm =3D dl->dl_ctxt; struct dlm_lock_resource *oldres =3D dl->dl_res; - struct dlm_lock_resource *res =3D NULL; + struct dlm_lock_resource *res =3D NULL, *iter; struct list_head *track_list; =20 spin_lock(&dlm->track_lock); @@ -556,11 +556,11 @@ static void *lockres_seq_start(struct seq_file *m, lo= ff_t *pos) } } =20 - list_for_each_entry(res, track_list, tracking) { - if (&res->tracking =3D=3D &dlm->tracking_list) - res =3D NULL; - else - dlm_lockres_get(res); + list_for_each_entry(iter, track_list, tracking) { + if (&iter->tracking !=3D &dlm->tracking_list) { + dlm_lockres_get(iter); + res =3D iter; + } break; } spin_unlock(&dlm->track_lock); base-commit: f443e374ae131c168a065ea1748feac6b2e76613 --=20 2.25.1