Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2884001rwb; Mon, 15 Aug 2022 13:16:20 -0700 (PDT) X-Google-Smtp-Source: AA6agR6JxatN10XNKOUp3Pbpa/v0+2vAfWlVk22mO/XLJ8RWHwgfZkeuCi37MkhHAM0z7+pay+ft X-Received: by 2002:a17:907:1c8f:b0:6e8:f898:63bb with SMTP id nb15-20020a1709071c8f00b006e8f89863bbmr11894141ejc.721.1660594579876; Mon, 15 Aug 2022 13:16:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660594579; cv=none; d=google.com; s=arc-20160816; b=aJFwuZfAdQ5iNUy/oGWWoZ9YTf4rAj/IkN48nBksXvyQCNUTUxSL5Oxpb4LxwjlINY 730ctowcbg3T+x2mLXNx9999lI2O729mjMmjZLQPVo9qPoIqQIpvjYGDMoRXzba6YobW /JUHy47kI2rMhAx62rKemzkDvGHHI7n08OrKyygqrY4tVwspXoHxvQzqcRl79R2E+kjJ fBxglr4BnVH/gvnba8Rwh6apWmZq8B0MjBvV/v44PV2dTFcQIT3ywxEh4v67mwAMvBaw ZBubA6BktfR1iuOKW/NQLzN8gLOHGiul8r++zlBNMVb8qnq/DQ0K9Y3aSgqzypnSoUEO WC2g== 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=VfuqYNYdjcUCOFQw80Y+YHxvQsFBxiVGfCRjCVzyEkY=; b=FnvT/0DbWjoTIp8Py9fyJdpgmM3Qkm8iq+nrIrYdVhj14pLzlXbPzyMdRHDONCbbiU Jq4RPEdaK6qHvOSAi3GQ7qItbOpPkpA3SRBBPLFIOuBgoiC4xBsgSFCuyhhR+ihYXHgc /Ar3GOLayVx3xKRgKp5cXQ613m0yYwaQyqChcu7l1PZXv8Nq1CxA0K/VZW1ivpck+gl3 VFx4KQWHdpgC6fZBg2scwI3V17vm//qNTmqmvfqlX1LKwExBH8pSeyVPp/TBtHrMsB9R tVgVWlRS4SEzy8nXl2Mf7bfb0UwNF+O4FSzSoRfP4oYcZPx4407SEkJ3YaJujtIbUI91 OchA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="UoHe/9P4"; 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 bf10-20020a0564021a4a00b0043d9b5a736bsi8458779edb.482.2022.08.15.13.15.54; Mon, 15 Aug 2022 13:16:19 -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="UoHe/9P4"; 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 S1344660AbiHOToH (ORCPT + 99 others); Mon, 15 Aug 2022 15:44:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344370AbiHOTkT (ORCPT ); Mon, 15 Aug 2022 15:40:19 -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 00592402E6; Mon, 15 Aug 2022 11:47:08 -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 3FD276120B; Mon, 15 Aug 2022 18:47:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31448C43142; Mon, 15 Aug 2022 18:47:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589227; bh=1UMCGvA0ZSvA0u3yFGaFpaWQTxDUFvSAfF08FhqPwPM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UoHe/9P4jQtmYqtMsVTbkWIpmS+j0l3HwB4ERuydDF25jZOpWokb3tax8dJYOW/ds CDBDHeij94JCsHyHvWeRiUPNjvB+mESWuyssmbB9w3gNckRQo1+jwq/aAktkqEYjbB 3/cho5of44Jmd6qqX0Z6pT31pELGCfDv4O+0gloY= 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.15 652/779] powerpc/pci: Fix PHB numbering when using opal-phbid Date: Mon, 15 Aug 2022 20:04:56 +0200 Message-Id: <20220815180405.240851737@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@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 08eea633c380..fc5187c6559a 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