Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3149107iog; Mon, 27 Jun 2022 10:07:45 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tuBmWBY8h0LdWsxKsRlhTHhQbOaEjMXUUIFuJjiF2GxG1a0ZKC4PxjUy594vGNr/tbTTMX X-Received: by 2002:a17:90b:4c0a:b0:1ec:e6b3:7690 with SMTP id na10-20020a17090b4c0a00b001ece6b37690mr21683756pjb.121.1656349665638; Mon, 27 Jun 2022 10:07:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656349665; cv=none; d=google.com; s=arc-20160816; b=vctdeEs4xg0rKoaEfYrLCLT3kqcOUnvCK67DNZLivlD5VTiTKDLVCjYudSCnpMGyNJ YmjutD/f0nFGYCRItzddYCkZ9havM2HPUqtjlb+1T28PbgkOhNO8WubhnmpsgoH6DBSw QZkcVXoam44JTV5rcqZV1tj3hOW3K3G1fzCFuCKexIsodD7NtvcjMjXbGbGuunhWsHJF aZ6Zh7aFMyrXs0w9UfKOyCW341GSoA695PcMQz2bBTzyHTJ65tobxNaP9nNRAGsevaH8 st4dijnpOQE48LzF+mGqZw+sbA6KG2la+9vGCQMlQPE0T5bnJnO/0joZRbD4nEf5Yh86 6YZw== 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=mtu93+Y2VWRvN8UL0mZl1XTuzpXWuuBJdYd5zJLIXLM=; b=aGMYZOKrfrat9MIw4S3MQjT8ebCxz485KG2nYGazAcKEJBrFqfzq4/Sq2PjZk/EWFp btahDEhCUyJPj6Sw8EL8pumu8Ao5BCdIwp+BAqOkSUVV4tULbTYuFqNEvB75itlES3MZ gmbKngPqIb7endwo95OGTot4Btv0ki1h0/wQry7RCzHH+WfloGuy9eC6MhccFd0sE2xt afp4Qch0hT//AcqRqJmGAlQjy52e3VtcSUa1/RBlBibEUvWYJnDylDI651Xym3aES7X6 k+7F+bESkQAKyQ2xKb3Nt1tKbsyzp0uVaPl2/M3u2L4wSn1yfq4D+Yv8+obO2RFzd/Gb QsWA== 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 n15-20020a65488f000000b0040c583c37eesi16144007pgs.601.2022.06.27.10.07.33; Mon, 27 Jun 2022 10:07:45 -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 S239652AbiF0Qvu (ORCPT + 99 others); Mon, 27 Jun 2022 12:51:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239536AbiF0QvY (ORCPT ); Mon, 27 Jun 2022 12:51:24 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C0C1B10FF5 for ; Mon, 27 Jun 2022 09:51:23 -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 C5C831758; Mon, 27 Jun 2022 09:51:23 -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 C99173F792; Mon, 27 Jun 2022 09:51:21 -0700 (PDT) From: Sudeep Holla To: linux-kernel@vger.kernel.org Cc: Sudeep Holla , Greg Kroah-Hartman , 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, Andy Shevchenko , Gavin Shan Subject: [PATCH v5 13/19] arch_topology: Check for non-negative value rather than -1 for IDs validity Date: Mon, 27 Jun 2022 17:50:41 +0100 Message-Id: <20220627165047.336669-14-sudeep.holla@arm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220627165047.336669-1-sudeep.holla@arm.com> References: <20220627165047.336669-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. Link: https://lore.kernel.org/r/20220621192034.3332546-14-sudeep.holla@arm.com Suggested-by: Andy Shevchenko Tested-by: Ionela Voinescu Reviewed-by: Gavin Shan 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