From nobody Sun Feb 8 18:28:08 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E86B231D36A for ; Fri, 24 Oct 2025 13:25:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761312355; cv=none; b=cQIyP+UBsLNzD8HbDl7ED0HVHvLRpUpOb7l7YxI6yfqroDdhm1hunwvGJiy+H+C9Qk2xUJZchAikMg2QlWfCRLgZP5BJ8eUYUiePzhFv0ypAWkitzK6kDlILI4B4Tu7WoAmceZYswyfZHrjXfoflg8Gm+DBD2osUWtknPlX1YoA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761312355; c=relaxed/simple; bh=dEvEcEaAEAJ00M+doNnzB97L5BEkFu161uwoejGWcZU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=K6EpKirUOKlYJE5RzqIrCf3ELDegV0K1dOCf5AIwd/dt/SBZi6O/Vj6xQSxR2qd3KU45DPEz7vvy+t1fRrgzfl1pX1xdD3YbMEiNo6mis0S0YjGEPJGifgOSXjjafSOEUFW26ZQB9rZXZAY0+MXUNIzN1cRHpscJIqtXs0eGyGk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=e5OQwXqU; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="e5OQwXqU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 368B0C113D0; Fri, 24 Oct 2025 13:25:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1761312354; bh=dEvEcEaAEAJ00M+doNnzB97L5BEkFu161uwoejGWcZU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e5OQwXqUFf0OI0pvGQDfhppEcdukL6zHGrKAptj2NXzAwW7tDly8Uh6QqVcSaEeVb TSGanVRuG4FFMfKGDwf1MfweRad943ipclXuJ8hJm0NJea84GFQKDUHl+zsBtdm7o4 YHPs6W7FTG4dwOqUjsENtadjvnrV50d6yXsKXPWyVrOmWuoxyqau2Ttog2p9fHs1nf l+LfEUH8xcsgFPOxcBLh19DHMBDZZiHr5oKNd5v/WYsaA1hN7BCpQnG5Mxt1F8CXJH UtSDWT1UsZXsLJrcqMscQAMNe7hRSp/ICeaKbV8Z5BrreH0zgDCCX6GpLnFRxG84AM hPEQmkf3wuvrQ== From: Frederic Weisbecker To: Thomas Gleixner Cc: LKML , Frederic Weisbecker , Anna-Maria Behnsen Subject: [PATCH 1/6] timers/migration: Convert "while" loops to use "for" Date: Fri, 24 Oct 2025 15:25:31 +0200 Message-ID: <20251024132536.39841-2-frederic@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251024132536.39841-1-frederic@kernel.org> References: <20251024132536.39841-1-frederic@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Both the "do while" and "while" loops in tmigr_setup_groups() eventually mimic the behaviour of "for" loops. Simplify accordingly. Signed-off-by: Frederic Weisbecker --- kernel/time/timer_migration.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/kernel/time/timer_migration.c b/kernel/time/timer_migration.c index c0c54dc5314c..1e371f1fdc86 100644 --- a/kernel/time/timer_migration.c +++ b/kernel/time/timer_migration.c @@ -1642,22 +1642,23 @@ static void tmigr_connect_child_parent(struct tmigr= _group *child, static int tmigr_setup_groups(unsigned int cpu, unsigned int node) { struct tmigr_group *group, *child, **stack; - int top =3D 0, err =3D 0, i =3D 0; + int i, top =3D 0, err =3D 0; struct list_head *lvllist; =20 stack =3D kcalloc(tmigr_hierarchy_levels, sizeof(*stack), GFP_KERNEL); if (!stack) return -ENOMEM; =20 - do { + for (i =3D 0; i < tmigr_hierarchy_levels; i++) { group =3D tmigr_get_group(cpu, node, i); if (IS_ERR(group)) { err =3D PTR_ERR(group); + i--; break; } =20 top =3D i; - stack[i++] =3D group; + stack[i] =3D group; =20 /* * When booting only less CPUs of a system than CPUs are @@ -1667,16 +1668,18 @@ static int tmigr_setup_groups(unsigned int cpu, uns= igned int node) * be different from tmigr_hierarchy_levels, contains only a * single group. */ - if (group->parent || list_is_singular(&tmigr_level_list[i - 1])) + if (group->parent || list_is_singular(&tmigr_level_list[i])) break; + } =20 - } while (i < tmigr_hierarchy_levels); + /* Assert single root without parent */ + if (WARN_ON_ONCE(i >=3D tmigr_hierarchy_levels)) + return -EINVAL; + if (WARN_ON_ONCE(!err && !group->parent && !list_is_singular(&tmigr_level= _list[top]))) + return -EINVAL; =20 - /* Assert single root */ - WARN_ON_ONCE(!err && !group->parent && !list_is_singular(&tmigr_level_lis= t[top])); - - while (i > 0) { - group =3D stack[--i]; + for (; i >=3D 0; i--) { + group =3D stack[i]; =20 if (err < 0) { list_del(&group->list); --=20 2.51.0