Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1752846pxb; Sat, 2 Apr 2022 02:05:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHRb1+WrTLzdmPDU9BMMjRfb5HOn15QIviK/LWR5sPK1IRepT/rTHZLLTPdDqfmWSxhd9r X-Received: by 2002:a17:906:3ec7:b0:6d6:e52b:b with SMTP id d7-20020a1709063ec700b006d6e52b000bmr3146564ejj.521.1648890356718; Sat, 02 Apr 2022 02:05:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648890356; cv=none; d=google.com; s=arc-20160816; b=0wJTCLcZe16UFKsY34OuJkGmEz/AqDnROy8x7S+rQLktAjWRPVm7i4cCbyGzfMuTxJ Lgst1MDgMJxWNABjtCZbYZTSJ4TQSUle2KW80K7JwEpXmmvyjqUwnc2oxlP3JqDUuiHe zWUHF1Xvkh+l/GB1n3eG2ywDaiqg/XnQZOQl7BvRdKg3ap5Gp989PE+RwrroeFPgmJWZ DMyQT7M02sfcQ6h3s4V3eYu0JMU1gh3k7AUjBjD0gMJ4f4lId6S6nrqz/72Ap1lHF/UF qfd2TFHoMk0zs1JhaOTtgD/dgibkUAkH5eewD31VNi1FGLohgCzEi4tqkEkXepFGkBBr q+tA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=nik1iTbxoUWnG6UF8WspcQRjvneqvZ965qd0fvy6u0Q=; b=odoPRsJFeynev+JiDmshMXvU5mjRqZltftjBsQ3NiiMWfPf8MLlHQALmh36d2WM7XG BYiNVaBsw5F43ZsNVMfveABU1b9byrgoB9H/G7hTmHxlq1J1Yqk+ea76BrMZAfS4ogQb IDbgEshThDOfKZiZkSuwBoti6sWwnXX/d/gXCeLHRE7YzWd8iU1nzoyVtUnQNex2+9Bx hhtncDEZHpJ4AqvQNuPLgvLw1w7iltNgQ5mAohwa3ZsJlE/Eh062yxJBQhnmJmVBfOMY xTHg6YEi7sfSOS3WQwfsofY15PsbjX1XK4Lm0aPNHevxvm1NrvUzyaSxPVJS16E8gA2i nPtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=onwlNXEf; 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=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q25-20020a1709064c9900b006df76385cf1si3025349eju.401.2022.04.02.02.05.31; Sat, 02 Apr 2022 02:05:56 -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=@gmail.com header.s=20210112 header.b=onwlNXEf; 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=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242525AbiCaWhi (ORCPT + 99 others); Thu, 31 Mar 2022 18:37:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240705AbiCaWhf (ORCPT ); Thu, 31 Mar 2022 18:37:35 -0400 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D61E71C8A8E; Thu, 31 Mar 2022 15:35:47 -0700 (PDT) Received: by mail-ej1-x62f.google.com with SMTP id p15so2199679ejc.7; Thu, 31 Mar 2022 15:35:47 -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=nik1iTbxoUWnG6UF8WspcQRjvneqvZ965qd0fvy6u0Q=; b=onwlNXEfsXY5267AxROmbVgwPHyozyAkfW/eFrSTJ29X2muD4OpT4LcAzhalPbQd/b CKKvVbnuI0cwUFkWWUdzbnGsJSK/fRV89XUWiC/WnV/yncPvIhtMQLgUICGaLathnPov SQyfqPvBUDIKdjR1LnGVk9ymAD/jMYdQ11bhYyZ6DboyOFk2Q51P/4WpDFx66Om+IUPr oLc4SWKuRN472tKQAwpou0cQPzrxZnWOpoX0P8iqr85CgjGt3djEDjxAQwAcR9K779Qe brkBa++inBLdnrRA2nDX/4m88mHASicccPQr2P8VaqCzfDtNDb6I/AVh+jqSYcSwCVvh 1sfQ== 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=nik1iTbxoUWnG6UF8WspcQRjvneqvZ965qd0fvy6u0Q=; b=k0Sk+aWfmTpdSHV5Fl8BjCF9aAhkfiHjwn7gpm0EITMz9pMBEbP7v/DSK68T/3UzBg htSUJWqVtblriVSv72bct7MjRbTz2xlICoq8uqsyen3bHQULkKTIIOUKxHn3sw/wrKYx ux7pieF0pm6LoXv2sRsbVOJzgOa0f4TEg8DfCWV3PysuXRx9P+B9qh8dy9Z0G8jywMr4 R0HT2I/abgakujS1xJRMiaJq+pXpmW6P47eIm9XhCTvm/hFu1U4N1c9sp6xeKWLL3tPU pEIibWl5kjxG7xEDuGLf7DjqHRFXmmg/iAln0szg/otOAoVRywUq46RMbgw63Wy2Zj+S ifww== X-Gm-Message-State: AOAM5304QjDr8rHJAu+kAULSImKhHqVV499TKpRBfk1Cmt3X8ks0ZCxO Ba9E68NtNPWXajvHQYTQ+RzbHS9rEP1uJSpS X-Received: by 2002:a17:907:9725:b0:6e0:b274:aa4c with SMTP id jg37-20020a170907972500b006e0b274aa4cmr6900584ejc.565.1648766146417; Thu, 31 Mar 2022 15:35:46 -0700 (PDT) Received: from localhost.localdomain (i130160.upc-i.chello.nl. [62.195.130.160]) by smtp.googlemail.com with ESMTPSA id p14-20020a05640210ce00b00413211746d4sm337761edu.51.2022.03.31.15.35.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Mar 2022 15:35:46 -0700 (PDT) From: Jakob Koschel To: Helge Deller Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Mike Rapoport , "Brian Johannesmeyer" , Cristiano Giuffrida , "Bos, H.J." , Jakob Koschel Subject: [PATCH] video: fbdev-MMP: replace usage of found with dedicated list iterator variable Date: Fri, 1 Apr 2022 00:35:03 +0200 Message-Id: <20220331223503.902142-1-jakobkoschel@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 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 instead of a found boolean [1]. This removes the need to use a found variable and simply checking if the variable was set, can determine if the break/goto was hit. Link: https://lore.kernel.org/all/CAHk-=wgRr_D8CB-D9Kg-c=EHreAsk5SqXPwr9Y7k9sA6cWXJ6w@mail.gmail.com/ [1] Signed-off-by: Jakob Koschel --- drivers/video/fbdev/mmp/core.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/video/fbdev/mmp/core.c b/drivers/video/fbdev/mmp/core.c index 154127256a2c..03707461eced 100644 --- a/drivers/video/fbdev/mmp/core.c +++ b/drivers/video/fbdev/mmp/core.c @@ -127,19 +127,18 @@ EXPORT_SYMBOL_GPL(mmp_unregister_panel); */ struct mmp_path *mmp_get_path(const char *name) { - struct mmp_path *path; - int found = 0; + struct mmp_path *path = NULL, *iter; mutex_lock(&disp_lock); - list_for_each_entry(path, &path_list, node) { - if (!strcmp(name, path->name)) { - found = 1; + list_for_each_entry(iter, &path_list, node) { + if (!strcmp(name, iter->name)) { + path = iter; break; } } mutex_unlock(&disp_lock); - return found ? path : NULL; + return path; } EXPORT_SYMBOL_GPL(mmp_get_path); base-commit: f82da161ea75dc4db21b2499e4b1facd36dab275 -- 2.25.1