Received: by 2002:ac0:de83:0:0:0:0:0 with SMTP id b3csp1447859imk; Mon, 4 Jul 2022 03:20:13 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tHF+6KZadcMKs6Uu4oJVuVPMIBrDQlF8P8jR/nO9L0vQ6CmYixFQeviNN4/5TkgP2DJb9a X-Received: by 2002:a17:906:7a0b:b0:722:dac6:a8ff with SMTP id d11-20020a1709067a0b00b00722dac6a8ffmr27860565ejo.593.1656930013659; Mon, 04 Jul 2022 03:20:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656930013; cv=none; d=google.com; s=arc-20160816; b=GgJsvQKJwj5BQGEPnnZSLkuV0IeIWKhCVMqvDdp06GleMLLBeFYAIpK3kg311RKkSA lNBGGshSTZOrZyma4sV2NSMNT8UL6S1ijp6yutNH5ZzmzztaPT0ZBazllKzrH/yu6942 GU2nJPO9ATylciX9cReLsyh7EuhWoaEaW43kZ6Ve49HlRJHa24gnbwlz3+2f15khj5wf r5btc6wbI+igps1FF/R6zF+c8KSm0qQi2A6OANDzlqLfpmTnvxWgxf1kdO6DdRE33GuP GDzfeYUv6q9K7qTmuUyMBll/8+Hd91JtvZCASgCAFPuvQfEVGQ1Mw2dPM76cKnLlv2/s mOtA== 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=37OTt7RcQN/D+Zay/LUTjF994irAP2dXCDLSQI9To3g=; b=pTZHEd8u2cdqEe1KwHX3Vp79fC3lzT3nDM2vRw4qzdMv+pBEjF1DhPqhdAuyBwabEb //uwDzwvm7C/guEejg+c3rVmZGxCAUZ6/aBUVGETiCtuUHU1Y7E4THrzMEOM0plF23Ms MIxLcy9f62lS1kCYGTnGD7BIpBE14qiG5We9ndSjOTD65Wxbh3SkonzYqsb3VdBX2R0/ 01ptRfKO9BEmGMXWBBN0ur3OnnzAh2hof9G/z1obR2dN2IPcxpjeQCclXNmhDW9qpcd5 rQlA2Klh2SdjobcMDXRdkiSPGH17n/ltAt6RabQZuEppKCUtgv8YD9pWkV/DoB3Mmtbh AEWw== 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 bu22-20020a170906a15600b007232e05af5fsi11438216ejb.77.2022.07.04.03.19.48; Mon, 04 Jul 2022 03:20:13 -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 S234426AbiGDKR5 (ORCPT + 99 others); Mon, 4 Jul 2022 06:17:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233711AbiGDKQp (ORCPT ); Mon, 4 Jul 2022 06:16:45 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C75C7D10F for ; Mon, 4 Jul 2022 03:16:44 -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 E25C723A; Mon, 4 Jul 2022 03:16:44 -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 945C43F792; Mon, 4 Jul 2022 03:16:42 -0700 (PDT) From: Sudeep Holla To: linux-kernel@vger.kernel.org, Greg Kroah-Hartman Cc: Sudeep Holla , conor.dooley@microchip.com, valentina.fernandezalanis@microchip.com, 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 v6 14/21] arch_topology: Check for non-negative value rather than -1 for IDs validity Date: Mon, 4 Jul 2022 11:15:58 +0100 Message-Id: <20220704101605.1318280-15-sudeep.holla@arm.com> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220704101605.1318280-1-sudeep.holla@arm.com> References: <20220704101605.1318280-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. 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 6ab173caf1dc..c0b0ee64a79d 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.37.0