Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1166548pxb; Thu, 24 Mar 2022 14:11:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKrOseIUbXckn5yY2YgI95JLKcl/rM2UutKjeyPTXxa8AbnSB4YHOH3MqTex5ph/KrzqLC X-Received: by 2002:a05:6402:54:b0:419:9b58:e305 with SMTP id f20-20020a056402005400b004199b58e305mr1671947edu.158.1648156280609; Thu, 24 Mar 2022 14:11:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648156280; cv=none; d=google.com; s=arc-20160816; b=rjdViJE5zc1jjTHXahv/SxQqzGRDaoDe1xBEliAbeW2cRG15mHYWRlNfiGY58iJEgL rkT1sFe0ULf6Kda5yaSFwNGO5kaqR0OzZDpFEkxiWEO1FkWrFiOd3wWr7OVA6+WmW2My DNlntCOLXx0pGEVIHot/0DwltCcRTxC+2XWpl9P6QBzoRR6NEua3G9gFpiIGJDR8+z9W Z6m55DvGHjN2oUTNRMJAv2lwKSbErsCq/UolcYpDgPllPoY3zjMF8gRgkLkA1KieFOju dcOgDnWJxSDMSTlntoEd7snmkrhzbPazjal3mKzH77dZElFXvpDA9IhU43r6XvTykh/7 n5Ow== 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=UusJwPTvawwqw4B13062bzCvDRIa/PfzdX6rZ/h/ofQ=; b=z5Sqhyy+L+cHllxEEmMcIcYbawC4rqeHS9iO7Ep1Zy/yZn4l/Bma2BeZHvs9xBjo1G LCGHkZg7dSlHeuRa6bP5zPtMF6A5RqndsZfG2S14dwLr1wILP2zCW9TNuV8+as3Y9tfd FDfbEz7B+6NzEqaJKxh+XYx38ZYucQxPiWRrGurQwWiL8ddKD/Y2RNCM29RCfK2iInio SW/K0xH0J6hpp6GR7GONSxfHygOkpgOpJ5qUYEMcHQisJo1+hbtfW3gFg/wzs9nPUArG e4fYqzc/5TSE9t+tOz1kTa8sCBD7yr/0EMNcu2rEjSx4WMkMvnbjSqUcXOSTEoefSRgR oBrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="BB/x7LbN"; 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 g5-20020a1709067c4500b006df76385c74si489745ejp.276.2022.03.24.14.10.54; Thu, 24 Mar 2022 14:11:20 -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="BB/x7LbN"; 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 S1348484AbiCXH02 (ORCPT + 99 others); Thu, 24 Mar 2022 03:26:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234921AbiCXH01 (ORCPT ); Thu, 24 Mar 2022 03:26:27 -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 D187A986F5; Thu, 24 Mar 2022 00:24:55 -0700 (PDT) Received: by mail-ed1-x52e.google.com with SMTP id t1so4550528edc.3; Thu, 24 Mar 2022 00:24:55 -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=UusJwPTvawwqw4B13062bzCvDRIa/PfzdX6rZ/h/ofQ=; b=BB/x7LbNUE8nHL64NA5MPWmuQTYC0FQt/zHFjd1px6EmZeQg9A8d9798/hSq21tR0h nkXZuo1YJcGC0N7KHdSZ0rH5Av6kBrOL1EDEeQVTBIhOisgr80e83O7jx3wqJDg8j0SU KautTEldNJTsFB/BzKiQW4Yx+WF3FypcXGApTqWh7JT6FCrRDin6k3ufHwa6U/Jxobsw 8RzBVUqbGcJeqXQOLh+SjRMQupj9Y2AwEmNisvQwStZ+kzCQ+PVYIPp9uAiRPX00QQ0Z sY4Wbpf4tpCUBsaYF/sGB/xEBhBKE+1RmwTVwQeprQB0V69KvA4FXpc9Zg1kP3pQs7RT oNWw== 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=UusJwPTvawwqw4B13062bzCvDRIa/PfzdX6rZ/h/ofQ=; b=XZz1owOAClExae8lG4LiOq6XL/7DDvbVrNpjWfpmDzsscSpa3yHq7B865922qraodw ySxFRHmcUnblkkZFv71ESBglvAXFRbAtKPK5YT+obHbFbN7TkQkJobLZrFAEGxo2yPuJ DkTJw6wUDf1bX2i4xhjtKsx9BEF9DqKaSUY+OMOqtFyWBVjhlLqVfW+sHk1RfXhg7Bb1 Q6No3NzGvQe50vycJiQvVvtn7m7moQqbjNEma2GVSXF0ysUY9Qql8ddKq/CToPUk+PDn 4CkQ1hQH2+Kc9qPxtYgoLB+OBBn5aRGD+2r8NFa6EqAaOaaGqbMei+gCO2L7kWvP3rho sxAg== X-Gm-Message-State: AOAM531LN2mvmsPKtJV7AAOOlbJaT0rx0F3s78fohIpWU+AyhfadvlJ1 dm1Uzv3XprheCQKVt8vkN/o= X-Received: by 2002:a50:cfc4:0:b0:413:b19d:d9c0 with SMTP id i4-20020a50cfc4000000b00413b19dd9c0mr5077856edk.384.1648106694346; Thu, 24 Mar 2022 00:24:54 -0700 (PDT) Received: from localhost.localdomain (i130160.upc-i.chello.nl. [62.195.130.160]) by smtp.googlemail.com with ESMTPSA id ep16-20020a1709069b5000b006daa26de2fbsm759578ejc.153.2022.03.24.00.24.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Mar 2022 00:24:54 -0700 (PDT) From: Jakob Koschel To: Andy Gross Cc: Bjorn Andersson , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Mike Rapoport , "Brian Johannesmeyer" , Cristiano Giuffrida , "Bos, H.J." , Jakob Koschel Subject: [PATCH] soc: qcom: pdr: replace usage of found with dedicated list iterator variable Date: Thu, 24 Mar 2022 08:24:35 +0100 Message-Id: <20220324072435.63070-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/ Signed-off-by: Jakob Koschel --- drivers/soc/qcom/pdr_interface.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/soc/qcom/pdr_interface.c b/drivers/soc/qcom/pdr_interface.c index fc580a3c4336..0034af927b48 100644 --- a/drivers/soc/qcom/pdr_interface.c +++ b/drivers/soc/qcom/pdr_interface.c @@ -304,24 +304,23 @@ static void pdr_indication_cb(struct qmi_handle *qmi, notifier_hdl); const struct servreg_state_updated_ind *ind_msg = data; struct pdr_list_node *ind; - struct pdr_service *pds; - bool found = false; + struct pdr_service *pds = NULL, *iter; if (!ind_msg || !ind_msg->service_path[0] || strlen(ind_msg->service_path) > SERVREG_NAME_LENGTH) return; mutex_lock(&pdr->list_lock); - list_for_each_entry(pds, &pdr->lookups, node) { - if (strcmp(pds->service_path, ind_msg->service_path)) + list_for_each_entry(iter, &pdr->lookups, node) { + if (strcmp(iter->service_path, ind_msg->service_path)) continue; - found = true; + pds = iter; break; } mutex_unlock(&pdr->list_lock); - if (!found) + if (!pds) return; pr_info("PDR: Indication received from %s, state: 0x%x, trans-id: %d\n", base-commit: f443e374ae131c168a065ea1748feac6b2e76613 -- 2.25.1