Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp4117703iog; Tue, 21 Jun 2022 12:23:20 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ujp7GXLHotX9e4Enw4/NCtB6GHIR8eSYrRZAbNgTyTIwnOyOUwF4d9L1stxTIdMr2mRRlC X-Received: by 2002:a17:90a:1b08:b0:1ec:91a3:532b with SMTP id q8-20020a17090a1b0800b001ec91a3532bmr19610703pjq.160.1655839400465; Tue, 21 Jun 2022 12:23:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655839400; cv=none; d=google.com; s=arc-20160816; b=JQ4T3Yahe1qVHNuUJhCpSMyUh8SMpFPe+13fRaNuGFfYtduRYLjJEen+B19ROZvuv9 myVMUjVrdykfizg5vBfvpxZ/riH4+cB8f7Ieaz3rLtQZ7V+3gfrtxc286x7nqy8PsuPW 97e6nKKFSfBdjOBCc7i0gHMn6Ls/6smz156juXKkLyqBVwY4KKghkM9gFBLJvGvNOAkt qDo13piN53CzBpsrTAWHMC5IDLCfoOj2cjONm0diVpkB2gpDzxGZzuad4299MStqj82d 7UGs9K8ga6vXxUkBGIFug/adOmaX/li2OkQ1YRqWEYjKSOvs/SiF2g2T2KgVoJKAzL6S 4pGw== 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=WQ/brFqjwtaHwpQrtvh9MLz43tP9yxHZCivqi4PIgFs=; b=Sjh1xmLw41SlYUt3fVAZyijkoYQldrR9LoWgd0A/VAFL97PYzlxMPC63TIVQxbdyXZ mfC47DOCDYXj9doI3/n9n2X3Rz438u0wUd2YKsdkxaRS7VVE9wHVWVedCwZy85r+wn86 +9q2CRWRqzwYNBIQL0BMvGFgFmEI0EcV6nJs2yqVpTmreUHjbXmCrQjm67P4daSou8Vt X/Oa7Dfx+4BxxExcj/Uapn//I+93UgtqZj58qChHn72/gMLMDnTtxU9fkr/jzV/dr6rJ 1t7hGZlkp1sYFIp1nTDoAkjCV0omGycUWd4Y7jzofBrLz+gb+XSBmiEa+Wrnx0EI7YhI GIUQ== 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 ch11-20020a056a00288b00b005253308b660si4446075pfb.286.2022.06.21.12.23.07; Tue, 21 Jun 2022 12:23: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; 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 S1353615AbiFUTVw (ORCPT + 99 others); Tue, 21 Jun 2022 15:21:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229592AbiFUTVO (ORCPT ); Tue, 21 Jun 2022 15:21:14 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B13FEF71 for ; Tue, 21 Jun 2022 12:21:13 -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 A81C1165C; Tue, 21 Jun 2022 12:21:13 -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 7D88B3F792; Tue, 21 Jun 2022 12:21:11 -0700 (PDT) From: Sudeep Holla To: linux-kernel@vger.kernel.org, Greg KH Cc: Sudeep Holla , Atish Patra , Atish Patra , Vincent Guittot , Dietmar Eggemann , Qing Wang , Rob Herring , "Rafael J . Wysocki" , Ionela Voinescu , Pierre Gondois , linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, Gavin Shan , Andy Shevchenko Subject: [PATCH v4 13/20] arch_topology: Check for non-negative value rather than -1 for IDs validity Date: Tue, 21 Jun 2022 20:20:27 +0100 Message-Id: <20220621192034.3332546-14-sudeep.holla@arm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621192034.3332546-1-sudeep.holla@arm.com> References: <20220621192034.3332546-1-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_NONE,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. Reviewed-by: Gavin Shan 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 7a5ff1ea5f00..ef90d9c00d9e 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -642,7 +642,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: @@ -714,7 +714,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