Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp4170742ioo; Wed, 25 May 2022 17:15:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwoeszT0MW2myTUGakCkNz+tLhbUN3OrsJnYJYS4W2j/NaNTNATiWoEtUYBOP0un7mY3xgZ X-Received: by 2002:a17:907:7f26:b0:6ff:ab8:e85 with SMTP id qf38-20020a1709077f2600b006ff0ab80e85mr7811177ejc.281.1653524111139; Wed, 25 May 2022 17:15:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653524111; cv=none; d=google.com; s=arc-20160816; b=J2Ujne7MSDYiKi86RUIhjD8VyvSRd8UYAbwB0zqBOYCCv/KPz2wC94Vh4+yw9USYCF 6lFVRGxXklUjyfkZrobMlRzWbDVflfNh1Sh9jKSWJfbkNQxxHG3IFTemuDrdv+Uq9kW+ ACMIuR3VgbHPMd0uI1oOSTxmwYN8ML04yXjy9QAd6U48UpPA0DTBtdRE06YGfeyenF7L V7OmKKFyLuO4h3qPjBhCEV5iQyURGEd3e5etNdgnzdGtxRceIxiSFAPfCgoarXsZt2ca fjc/xW/BRPV2h6QjgyZkXKDGMvRWWaqcWvsIMaOA3OxaqfIjC1vZXcDJ4QFOR83RPN+G Ww+Q== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=raQrssCELTFjImDksQBWTrPfraBuZZBbYTjrwjqoRi8=; b=nmxQ08S0kdRQK7s+EB/A9yW83uSrbM0wSwz3TN7rp+epvACIhJWBM+Ecs/09bSk9r9 zuM/WwUe+C9Mf/oVwJ8UVIDouTulvTPaAH5Ja4m2doeiQv+52Axpcgeb/KZZYb2QjrGs r9lphtd/eREr/ODFUkyLUozxW0nY3HKjXAo71sk6v2jt7FacojxptpQT2oNIsx5A8wHa i7ElS0ZY8WyBeyiFGNndE7TxBmd+hT+YlJnGn2kIViiYziD/S2+3VzzurH2q8zli+Drk atVUzK5aBVBWNMZvGewmH7Kc1vDFrrn1LQ/fi3thR/OdTtPJjBc0B94/kT+Qu3Pv9VGV V+1A== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sb1-20020a170906edc100b006fe7ef71a5asi24324ejb.902.2022.05.25.17.14.44; Wed, 25 May 2022 17:15:11 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231277AbiEYIQd (ORCPT + 99 others); Wed, 25 May 2022 04:16:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237753AbiEYIO7 (ORCPT ); Wed, 25 May 2022 04:14:59 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9A73284A19 for ; Wed, 25 May 2022 01:14:56 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E5B091FB; Wed, 25 May 2022 01:14:55 -0700 (PDT) Received: from usa.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 0645C3F73D; Wed, 25 May 2022 01:14:53 -0700 (PDT) From: Sudeep Holla To: linux-kernel@vger.kernel.org Cc: Sudeep Holla , Atish Patra , Atish Patra , Vincent Guittot , Morten Rasmussen , Dietmar Eggemann , Qing Wang , linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, Rob Herring , Andy Shevchenko Subject: [PATCH v3 11/16] arch_topology: Check for non-negative value rather than -1 for IDs validity Date: Wed, 25 May 2022 09:14:11 +0100 Message-Id: <20220525081416.3306043-12-sudeep.holla@arm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220525081416.3306043-11-sudeep.holla@arm.com> References: <20220525081416.3306043-1-sudeep.holla@arm.com> <20220525081416.3306043-2-sudeep.holla@arm.com> <20220525081416.3306043-3-sudeep.holla@arm.com> <20220525081416.3306043-4-sudeep.holla@arm.com> <20220525081416.3306043-5-sudeep.holla@arm.com> <20220525081416.3306043-6-sudeep.holla@arm.com> <20220525081416.3306043-7-sudeep.holla@arm.com> <20220525081416.3306043-8-sudeep.holla@arm.com> <20220525081416.3306043-9-sudeep.holla@arm.com> <20220525081416.3306043-10-sudeep.holla@arm.com> <20220525081416.3306043-11-sudeep.holla@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, 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 Instead of just comparing the cpu topology IDs with -1 to check their validity, improve that by checking for a valid non-negative value. Suggested-by: Andy Shevchenko Signed-off-by: Sudeep Holla --- drivers/base/arch_topology.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index 59dc2c80c439..f73a5e669e42 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -637,7 +637,7 @@ static int __init parse_dt_topology(void) * only mark cores described in the DT as possible. */ for_each_possible_cpu(cpu) - if (cpu_topology[cpu].package_id == -1) + if (cpu_topology[cpu].package_id < 0) ret = -EINVAL; out_map: @@ -709,7 +709,7 @@ void update_siblings_masks(unsigned int cpuid) if (cpuid_topo->cluster_id != cpu_topo->cluster_id) continue; - if (cpuid_topo->cluster_id != -1) { + if (cpuid_topo->cluster_id >= 0) { cpumask_set_cpu(cpu, &cpuid_topo->cluster_sibling); cpumask_set_cpu(cpuid, &cpu_topo->cluster_sibling); } -- 2.36.1