Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3406653rwa; Tue, 23 Aug 2022 04:22:23 -0700 (PDT) X-Google-Smtp-Source: AA6agR4ZEEbkGynlwXdKcmNgC5hgd6kpgH2wfxJw1tiqMt/V1XhRR7+1Gvokn3szsMfw34Wkxvfj X-Received: by 2002:aa7:dc0d:0:b0:443:e1ca:bdb1 with SMTP id b13-20020aa7dc0d000000b00443e1cabdb1mr3312381edu.62.1661253743047; Tue, 23 Aug 2022 04:22:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661253743; cv=none; d=google.com; s=arc-20160816; b=RO81ViSxDL2zD0TSJmJNAxRwoKARD2NPLi6pvdMObo4CQMzG0fHTzusbgvDrMVfed1 ZUNkI0AObWn9UqaE/Udc2GYpWaotWHzA2AFgP2ZomP0MrqlkVzlKBNZEcYjVHXUv8pgQ xmXgON+PKsOYA3LW+DBlloCypQNvAnfU2fijWIPqXakskAAOYEAbQwtrnRB7NZuoOhLa JaQO2ZpnBEmzx4dgyYU0/d0OJ3Y1KrXf/Wu56+8hV+ehWjpGmcvzanu2iIVUpDAjGdOf Tu7jo0WmPbbqVoql9XLBRRu95II92pz4YCaxec8BpDQFlJgXwUf8n4tEIRyLZG2s9BYz zxXw== 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=/KwF8TJJdxWHSY1FUsxIHp/vzzWCDwo52NxQ/wDBDZM=; b=ApZdLsyYGbHc2ri0LrpZcyLL/qROWAXn3ERDv1iPj8O3wKC2j0lajKJ+Uqv5Zlfx2J 4QsV9vt0rhN6xIQq3ZT9AsrTe/WgdWyjo0BwaEcDPw32ArcUoEYIPyQSwdKIlqDeYFTa A/77n7OXfPX544MuD1r5NbDibrz8O957d5F4kL8iSehp6gBjBbIossk0JeOd63cJGkQ3 L+iiQN1Wd/xeU2EcAWIdJcBxZ44xUQ0iEiJNvn5q3isgvrme/dxtpnl0LFa8zzfcvG2l YBvxYYmFhn5VLu1Ft2SHooDwdOS9F3k5Bzx8NYWeVLefeR+ilhtSdUBICH06zb0TOppX Yv0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WGgjpk4U; 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 v19-20020a50d593000000b00441ec11be8esi1694285edi.111.2022.08.23.04.21.57; Tue, 23 Aug 2022 04:22:23 -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=WGgjpk4U; 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 S1356852AbiHWKwZ (ORCPT + 99 others); Tue, 23 Aug 2022 06:52:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348824AbiHWKoz (ORCPT ); Tue, 23 Aug 2022 06:44:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D65731F623; Tue, 23 Aug 2022 02:10:39 -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 8AECFB81C63; Tue, 23 Aug 2022 09:10:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8AC5C433D6; Tue, 23 Aug 2022 09:10:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661245837; bh=M7TKMYo57ff+jZ0hl6iAQ7cIE6ReY/Atz2km7YpeMGo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WGgjpk4UIsm2C67OsB5S9jzpk3ww5FCTG8gcW0TSW3R7nXB0WIYIxV7EjjqXGnoVJ BzMnRbq2chue/0cxht+6WGuMAWqdL0XWH53lQLpq5OcM+dNkJKk3Am2Jux5pZfufXI GrDU4NFMikqel0NrOflnTqYElIL6zLP1eC2eZx0A= 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 4.19 175/287] powerpc/pci: Fix PHB numbering when using opal-phbid Date: Tue, 23 Aug 2022 10:25:44 +0200 Message-Id: <20220823080106.654879180@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080100.268827165@linuxfoundation.org> References: <20220823080100.268827165@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 b0bd55f2ce3a..740dcbdd56d8 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c @@ -98,11 +98,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