Received: by 2002:a05:6a10:87d6:0:0:0:0 with SMTP id g22csp656766pxr; Mon, 11 Apr 2022 03:58:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxK1I+8eHX3nlS/x26y1bDbehhqoUWegH6wFt5qdhqu7xgjHQneZfZHMYm3w6FO2wIMA3hy X-Received: by 2002:a17:902:e741:b0:14f:a1e1:b9b3 with SMTP id p1-20020a170902e74100b0014fa1e1b9b3mr1553346plf.36.1649674738336; Mon, 11 Apr 2022 03:58:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649674738; cv=none; d=google.com; s=arc-20160816; b=m/W8mWwbsWOZ8rCsx87NRQZsTCF29ZIHBl2s4pBmnNOBovpHDhl1shkNw/6/pGrs50 CTNPBw0OVBopn4Lt/hS/54lhjbCHqj5RmH2CI25o40ynP7OT6tYHOuVbdXuoF8QDwIsm axggU8uFhC2r0l4Car4FJ+TPow3Ffzo2/TofYGtqBhuCwC0VC8FqZ2PmupeJRdZvEX0o S4OrNq5zycdo3vpTBLSbgZl0oxFIHkl3lISuq1Wvdwpiylx1WE6tMLbLxSlrX06bz5+n DFrnDpCGZzUmw0KsMDXpPJRCwWpx5KFrEgFLh4J7BYz4s0zrGgSWHqvVtNHshR+bn/HB 9yAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=/4DvrRiBliTnNxzv/WZdw0whMDx63qjdwBl3NhxmHFE=; b=yw7XEJMKfwDdDNLukWbW6c+k4wWdYP+mmYU6flwYeEuL6KgMngSRI5e932KzR9dC9k ByeTMOnJiPdKGtgy+RnC6cmQKWhiBysq/B9Vv1RVoNpH+fjIjn2bQWoddz2r9ARxW1dK 5eSxVn4Ox3UJRRBgvuTB0odmcgqElAuCfjT1LmyrRv9KhzsamnMLxTA+6kzLSlwoWDVY lMy7iYQyarcm5lu1/VNRR7biTsfz+QZU/tm8wX1YvkvFVrN9wQkSTjb7uUPt3I7oEwrd SwL/IXD2nhURCN0AI1VeQMsKnNmRdpnoUfVenFCa9qsUbg4C3GEId9W8bxUKlD8XsYf5 ICDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=VoUWQcmp; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w6-20020a636206000000b0039ce7136f94si8997894pgb.408.2022.04.11.03.58.45; Mon, 11 Apr 2022 03:58:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=VoUWQcmp; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236921AbiDJKtY (ORCPT + 99 others); Sun, 10 Apr 2022 06:49:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234773AbiDJKtQ (ORCPT ); Sun, 10 Apr 2022 06:49:16 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B18B952B1C; Sun, 10 Apr 2022 03:47:06 -0700 (PDT) Date: Sun, 10 Apr 2022 10:47:04 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1649587625; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/4DvrRiBliTnNxzv/WZdw0whMDx63qjdwBl3NhxmHFE=; b=VoUWQcmpe7cDD4kJO6T4W55+qxOlIpOAFknlOmYtu1PLwSqLT11Ll7tOt1dmv6vpZI3EvF IlZ/gf2zUGEN7q2WCSoNfR+Ex95y4jAHSL84nvPrlzWqeP9p1CJ5nhEvneMulO91zOswep UgV/VQoidVdxv1GqTcQSXOc455Ozf5I4L9S5xkPbJetRLOfSujAOmY/9y4Vqe+AsWnKYwr SdSXO+uzL2Ng7PVxv60etPvJsZqSUjflqfzN89Q9flc2kg1J3mAHhPwUomzQ2uvOF744Vx yn/bku0hnFQ3HjPUVTVSimCjihxlEcdnV7+lMfl2904XjFBbJ+NuB5DoVXYs6g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1649587625; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/4DvrRiBliTnNxzv/WZdw0whMDx63qjdwBl3NhxmHFE=; b=G9CL6wzvgc8CFqFjK4/83zscUYytF1RDopffJ4xysmjXRQyv8WX22WPxqrFAMTFjfgmtct lUoJMOGMPgvpYgCw== From: "tip-bot2 for Jakob Koschel" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/core] clockevents: Use dedicated list iterator variable Cc: Jakob Koschel , Thomas Gleixner , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20220331215707.883957-1-jakobkoschel@gmail.com> References: <20220331215707.883957-1-jakobkoschel@gmail.com> MIME-Version: 1.0 Message-ID: <164958762429.4207.13314961588650668115.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the timers/core branch of tip: Commit-ID: 2966a9918dfab183a1cb6be6794981ebe2abff83 Gitweb: https://git.kernel.org/tip/2966a9918dfab183a1cb6be6794981ebe2abff83 Author: Jakob Koschel AuthorDate: Thu, 31 Mar 2022 23:57:07 +02:00 Committer: Thomas Gleixner CommitterDate: Sun, 10 Apr 2022 12:38:45 +02:00 clockevents: Use dedicated list iterator variable 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. Signed-off-by: Jakob Koschel Signed-off-by: Thomas Gleixner Link: https://lore.kernel.org/all/CAHk-=wgRr_D8CB-D9Kg-c=EHreAsk5SqXPwr9Y7k9sA6cWXJ6w@mail.gmail.com/ Link: https://lore.kernel.org/r/20220331215707.883957-1-jakobkoschel@gmail.com --- kernel/time/clockevents.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c index 003ccf3..5d85014 100644 --- a/kernel/time/clockevents.c +++ b/kernel/time/clockevents.c @@ -690,7 +690,7 @@ static ssize_t unbind_device_store(struct device *dev, { char name[CS_NAME_LEN]; ssize_t ret = sysfs_get_uname(buf, name, count); - struct clock_event_device *ce; + struct clock_event_device *ce = NULL, *iter; if (ret < 0) return ret; @@ -698,9 +698,10 @@ static ssize_t unbind_device_store(struct device *dev, ret = -ENODEV; mutex_lock(&clockevents_mutex); raw_spin_lock_irq(&clockevents_lock); - list_for_each_entry(ce, &clockevent_devices, list) { - if (!strcmp(ce->name, name)) { - ret = __clockevents_try_unbind(ce, dev->id); + list_for_each_entry(iter, &clockevent_devices, list) { + if (!strcmp(iter->name, name)) { + ret = __clockevents_try_unbind(iter, dev->id); + ce = iter; break; } }