Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3095081rwb; Mon, 15 Aug 2022 18:00:40 -0700 (PDT) X-Google-Smtp-Source: AA6agR5YPMrIWTynkKPnU8kN4CDQ0QltejR8HlNuXISUgMAV2g6sE2WC/aC9eUCgzZtDlZYtjQWd X-Received: by 2002:a05:6402:3550:b0:43d:e475:7d2f with SMTP id f16-20020a056402355000b0043de4757d2fmr16479294edd.166.1660611639949; Mon, 15 Aug 2022 18:00:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660611639; cv=none; d=google.com; s=arc-20160816; b=blkeZ4r5mRY3Ha7fM1idfX3fN1Y9akDpTy5d5KdqQ4IIM8UcCwOFUXTqmtHFsQT2tM yh7apz/M+Sa6BKuTIQXviaEEoZgHv0d+7wkjxRgi3bWOyL9vlDFyMKKtNmY8+trZikgm 6wxe3v9rD5nYYwT1NRZX+KjMH9Q3Sr7OFjFsLZ8Rit6nH0NyD0Lh6nsKhE1Yj7dhPZYm FDRxUPNjNiW5A5oTgIAnw+h96+ko1QsRigehE7i0OlcZ1t07ZlOX8cTNuXDcCSbG0EJb GJS7ZOJSbb1CpUfuA6r2ECfRbpBo3MGfRSHDi5UYtVKZBPhtMkpjZGLndipps4q4bB6a 0kDg== 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=efmAcFxQOEkc+J6oj1/v6rvekdWLsjOnIi5tHejCr3k=; b=sJRQbp1OnOtSjFXDTcTqYDoxgyV63ZTHDbwGtCSls/qtUooq5ZD++oJmiM8ArYMSUj J/+DpKrR1Rq7MHJgh5F/0rTDezvo7qmjjbCHvE2YACShi7wj3dtnxOYNinhiBJWwV1sZ MxjzAMbp8emHheRVCdBOfp/r90SXOOt76C8maDshPqfRgKBNu4MtOaMYrt6OxL5Kiv7f vv4PLnRbH4cup+wdN04EqSLlZXoZhhZKJ4x2BqgXhOKzXOUzIeuQyfstTvBNqrZ1IxsM xV9GnDSsUTjPzGl+h06kpYiOdh83tjn/z8ELQyN6uoMS9TwKuMF2ogBB3JoN5U+l1dtf +itQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DyJ9GGwu; 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 he7-20020a1709073d8700b007310137867csi9312935ejc.916.2022.08.15.18.00.08; Mon, 15 Aug 2022 18:00:39 -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=DyJ9GGwu; 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 S242913AbiHPAy3 (ORCPT + 99 others); Mon, 15 Aug 2022 20:54:29 -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: 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 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 = 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