From nobody Mon Sep 29 22:46:57 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B01D1C00140 for ; Tue, 16 Aug 2022 00:54:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243505AbiHPAye (ORCPT ); Mon, 15 Aug 2022 20:54:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242350AbiHPArF (ORCPT ); Mon, 15 Aug 2022 20:47:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06DD7197B88; Mon, 15 Aug 2022 13:45:44 -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 ams.source.kernel.org (Postfix) with ESMTPS id 652C3B811A0; Mon, 15 Aug 2022 20:45:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB004C433C1; Mon, 15 Aug 2022 20:45:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660596342; bh=s1VU8Oz7bh5fv2iQebK9iNjwCoHIbzx+5W1iUloCXxk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DyJ9GGwudT/O+vNtyeMrfuuSDfBXPO4ZaEJbRAjeG+sz132+5naPmaL5TviCgs8EZ RDv0r8/ckUnH0LmpS/d4B7AKsiv8NG1EDBVP4qAYnEEOlT3SvemlOTGCHO7bxA5LwW TQgjrTkU8jxsrUk2roGp0cGr1hWgks+/Ql+rrA2M= 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.19 1016/1157] powerpc/pci: Fix PHB numbering when using opal-phbid Date: Mon, 15 Aug 2022 20:06:12 +0200 Message-Id: <20220815180520.517075068@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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 =3D=3D 0. But then the if (ret >=3D 0) is true, and the body of that if statement sets prop =3D ret which throws away the value that was just read from "ibm,opal-phbid". Fix the logic by only doing the ret >=3D 0 check in the of_alias_get_id() case. Fixes: 0fe1e96fef0a ("powerpc/pci: Prefer PCI domain assignment via DT 'lin= ux,pci-domain' and alias") Reviewed-by: Pali Roh=C3=A1r 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-com= mon.c index b2b12ce44b5f..c787df126ada 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 =3D of_property_read_u64(dn, "ibm,opal-phbid", &prop); - if (ret) + + if (ret) { ret =3D of_alias_get_id(dn, "pci"); - if (ret >=3D 0) { - prop =3D ret; - ret =3D 0; + if (ret >=3D 0) { + prop =3D ret; + ret =3D 0; + } } if (ret) { u32 prop_32; --=20 2.35.1