Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3029859rwb; Mon, 15 Aug 2022 16:28:48 -0700 (PDT) X-Google-Smtp-Source: AA6agR5SCR9TuC4QK7VafD/6pqLKSYdAJ9BQ0YUD/DTjNEHvJO8vB0Ek/+HASS9goF4Quf1ZrzxS X-Received: by 2002:a17:906:9b0a:b0:730:d37b:4712 with SMTP id eo10-20020a1709069b0a00b00730d37b4712mr11461393ejc.537.1660606128484; Mon, 15 Aug 2022 16:28:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660606128; cv=none; d=google.com; s=arc-20160816; b=PcFmM2XDQLUjPRRAqI0RBPQym8otLud7kI9Lp1QQdY6L64V8nOzXWrGKVGOPiEkgJH g3V5qCatGOOsNnp6EfcTOAVoWecN6vlYgP3J8qP5oysfLmCX2L+Ho99xO1RDGp3YRkxo V0QM50nNU9inVZFZVFLIl+ppVegENbW3D3ahljIBTa7+g1MGZ1d6YJcoBouROfhjTSy5 2vorWQpTidPK0EzWA2Fw/dgtu+0cNj6sE4Z6/3rz84GLe7R0A6LwghlnLeDwIRxmvX3F ezROh+/dugMzXKbkHOZoWxMaoLgVETjWjP8gwwqfDmFceeOuWe1lEAThS5rGmq4oXIbL 3vjw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xdd/yXhc/olHlaWt+jYbAnlL8mSfGyQkAd14FJqqTTw=; b=TrV72EZg5eLNsG0oJWLh0QRI9ucCwF4q4fTIU2bhSFFxZNYoORFcHMyIkvczGgvRkj iW0pOv5zsmmvrFB1uvD4gIRo4M3eyk3PPhdz4bymEmW1mEy8Dy0NIcebEuk+Avhk7RrO rhmbT//5YvN8BHtemr96zL6mxTbIfiSd7zmSmF3+OwSMYvE6sSrfAvtUzPr50zS1fWim FUr9+S6h172ZZ2njzIklgQgrdcy3aIjdGr0nMsIvxq8jBiS44crM/QKAralOnZVIx5+y 3grbFAx5HpWqrvh5dACtZXqKJEi6Pmrc9FLby2bVxQiBAVuZSf05+kgtkYncK1BBERRL X1oQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2pCp8FMG; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sg7-20020a170907a40700b007120a60b38asi9225175ejc.1001.2022.08.15.16.28.22; Mon, 15 Aug 2022 16:28:48 -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=@linuxfoundation.org header.s=korg header.b=2pCp8FMG; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352970AbiHOXBo (ORCPT + 99 others); Mon, 15 Aug 2022 19:01:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352507AbiHOW6f (ORCPT ); Mon, 15 Aug 2022 18:58:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C10C2753A7; Mon, 15 Aug 2022 12:56:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 60F536068D; Mon, 15 Aug 2022 19:56:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FC11C433C1; Mon, 15 Aug 2022 19:56:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593412; bh=KmOHx/U+CI3H4Ml+/HVt3af5XMOhhlGluF+L0ZQQOOs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2pCp8FMGK/MeI4LJ4M1prcGB5FVBs5X2WPwssmxJfV2hhHWtvMgY8ZATvBjjntzLu Rz9o+F6pYqqso+UgOhpTd+wmvugBKyiDOyHW8xcsGOzgj3IR6G7L6rMe9X9hD0rxrD U7+uZ9MD63dEdGLIZY6B6ikc7qCG3OgxcdKMBSgU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Pali=20Roh=C3=A1r?= , Michael Ellerman , Sasha Levin Subject: [PATCH 5.18 0942/1095] powerpc/pci: Fix PHB numbering when using opal-phbid Date: Mon, 15 Aug 2022 20:05:41 +0200 Message-Id: <20220815180508.152502580@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 From: Michael Ellerman [ Upstream commit f4b39e88b42d13366b831270306326b5c20971ca ] The recent change to the PHB numbering logic has a logic error in the handling of "ibm,opal-phbid". When an "ibm,opal-phbid" property is present, &prop is written to and ret is set to zero. The following call to of_alias_get_id() is skipped because ret == 0. But then the if (ret >= 0) is true, and the body of that if statement sets prop = ret which throws away the value that was just read from "ibm,opal-phbid". Fix the logic by only doing the ret >= 0 check in the of_alias_get_id() case. Fixes: 0fe1e96fef0a ("powerpc/pci: Prefer PCI domain assignment via DT 'linux,pci-domain' and alias") Reviewed-by: Pali Rohár Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220802105723.1055178-1-mpe@ellerman.id.au Signed-off-by: Sasha Levin --- arch/powerpc/kernel/pci-common.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index 7daa00f3942e..aa37faeb80ee 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c @@ -90,11 +90,13 @@ static int get_phb_number(struct device_node *dn) } if (ret) ret = of_property_read_u64(dn, "ibm,opal-phbid", &prop); - if (ret) + + if (ret) { ret = of_alias_get_id(dn, "pci"); - if (ret >= 0) { - prop = ret; - ret = 0; + if (ret >= 0) { + prop = ret; + ret = 0; + } } if (ret) { u32 prop_32; -- 2.35.1