From nobody Fri Sep 25 20:03:07 2026 Received: from mail-oi1-f173.google.com (mail-oi1-f173.google.com [209.85.167.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 340B4323416 for ; Wed, 9 Sep 2026 02:23:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788920582; cv=none; b=SGWgi3GLNVN6lgEVgLkRCNsBdWJfgi65LJShmKqwm0hkUG4kIP55903nxJJGAhbOeFsiuvPrd9JEZHND9q5kjIpKszq83DCyme9aPN3a5D+O+gxs5vr9p2/JsaAiTxL4i5y/a5BOae/6nBbullTcYguF4njr1Wsw1KQzLtw0F4k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788920582; c=relaxed/simple; bh=kahNmhGL8r0OStd+UDk1yegSCb1Wry94V4qhk0XcnPY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Fid35R8lNRDSbVi/AI9mSmR1oB59SrbDBN91HvRDkocaYCLVS7uM71HvpdsQ0iogTuEp09ga5OStNc+HusTtwqbYOhs2mP2KAMhnbWCY081VeduLiLxjDptWgltrIbnck8Sv9dRhHe+lAYT2lJ4sfJALmSVVIDIifCKO5G6e/cI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=mCAVcNKZ; arc=none smtp.client-ip=209.85.167.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mCAVcNKZ" Received: by mail-oi1-f173.google.com with SMTP id 5614622812f47-4b5b727be96so3305908b6e.3 for ; Tue, 08 Sep 2026 19:23:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788920580; x=1789525380; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=VZMyQef+oIqclLbtgPWrdXN2+jow9YDnTQ19wlR5TNs=; b=mCAVcNKZc+1JZK03AAOp/VBYhRQz5oNSv+yRNRsJaiIS8pgfXyv9YidJsykTBKvOZo wE++7BTif5mnAUIDmu7E0wzbRmRgkue57KBXN2dhNNgrWIZHmxn9mfdHoqvYykCEc4JY MQ/gEcC0SO5s0apmeXNO+Y0sjGdcwM00xWkywPOdNpNnlEal606DZSp3rN9JGNGstzRG HLZoMEmfyvIc/LuDuSKO0WBtQUKR0x1NxdrVRYnFNiRdFWF5Uiv/UK9oysohp6T+HKxl JySH6s8IBnGbuKe6tYDz/ZMkigyaSD1GaUHqmn5BygLemjf/1gpx+1P9maJmM5dG+4Ps FQ5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788920580; x=1789525380; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=VZMyQef+oIqclLbtgPWrdXN2+jow9YDnTQ19wlR5TNs=; b=Cgdlrf9hQYwrgQkYGocRmBWQ+2++7gLJPKgFH+1bZ+7Gh3Po0a6boO7K1/DXCciSEq YXe0na4rSBb0Xy7aB+i30pDL4+jiD1AksAbwQhcamW5Kxsq1tnKyhI4EN1wg1x9FA7gu z1qCXOdFy9eP4sv5+d9uczfonfdw6mm/DibGrQiywOX/e0QhDlzRG3RgRsB6AwchQtgQ pjB4riO9MQEoYz1YTyAo+8c4H2YXUSaGylWbtEBBwSNFYNkofvCj7rczhWgEUxsDFlaE uNzFit4T56V4opxwdYaV8vAVZ/PNFMJkKOqKRrMi1d8FiQLSZXi8GkDId33pKK9bKMV6 iPkA== X-Forwarded-Encrypted: i=1; AKwUvBwYT9Zh8M8hOU70K8HVEiqYmH+cDY/EtveczdTEwEdGMMa1uv9nJ65vAQvlSvxZFfPKoZiFkph+5FMK/4k=@vger.kernel.org X-Gm-Message-State: AFuF++lO1HSUeuffGwG8PFljXK74d/u2HmtJ+VrH0n8s433uJBjdLqRh 6PpqvRWHZe4X6MK/HdC6paPXSF0yDVMtE0IAm/6lgnm9qMaCGXN+T/8F X-Gm-Gg: AYBFou2B56t23XD0wSVOIz7Lr7zG97AjJdkfQUUe6/Ig/tmnIe5V9ha01LrH018BhU7 xUeOIhG06JRcgVFnSdCC9iNyvH9bOJDVK9NCQ6WWFIDBWdC7eYvAsFWlv6T/sDMgB5G+GssSka9 Pfl1RiMKh42WjAAJAvC7LDIi+G5NNgu51xIJ8aeNqF4qTJMYb0dQkQMa98xaOE+dn6QUBVC1W44 ucfnnucTWuh8luM7cHqKuWpVSmTzn3BUC6Eo73cMVS+lS7PAB2QULz9QBv2Cmx2+SkjLUo6mnKa KuM655HdP/NRpGstZh6M7iPW81PsZfiNj6ITzyHiXXJu9HW9bdwDYXAKXS6B1SH/DzFtgXwe+Tq bSGIJfiy3WTgxwqCydMMTaUmkclhngfShPH8t6fKBeCu2SVPvRAiI/iim3evJXp1+GlPc91+3n/ O6zUJ09A2+7bzWFpNEJCOjowMfFrZNFJOzdwyAnm+rFph0tH7DTQN++JDBtYcfkkBN7Oj9HM71N +UmYpE96cU6L5/DNv63Suy46w== X-Received: by 2002:a05:6808:1783:b0:4b1:b83a:5878 with SMTP id 5614622812f47-4b961a7b906mr20611009b6e.14.1788920579975; Tue, 08 Sep 2026 19:22:59 -0700 (PDT) Received: from david-hassan-Inspiron-15-3567 ([69.162.230.54]) by smtp.gmail.com with ESMTPSA id 5614622812f47-4b971aa12cesm15580584b6e.16.2026.09.08.19.22.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2026 19:22:57 -0700 (PDT) From: Fahmy Hassan To: helgaas@kernel.org, bhelgaas@google.com, scott@spiteful.org Cc: fahmymohammed@gmail.com, kees@kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH v2 1/5] PCI: cpqphp: Check pci_hp_add_bridge() return value Date: Tue, 8 Sep 2026 20:22:22 -0600 Message-ID: <20260909022227.620217-2-fahmymohammed@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260909022227.620217-1-fahmymohammed@gmail.com> References: <20260909014143.GA123333@bhelgaas> <20260909022227.620217-1-fahmymohammed@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" cpqhp_configure_device() calls pci_hp_add_bridge() without checking its return value. pci_hp_add_bridge() already logs an error for one failure path (no bus number available for the hot-added bridge), but returns silently if the bridge's subordinate bus isn't created after scanning -- that path goes completely unreported, and either way the caller currently has no way to notice or react to the failure. Log an error via the driver's existing err() macro when pci_hp_add_bridge() fails, identifying the device involved, and remove the now-resolved TODO entry. Signed-off-by: Fahmy Hassan --- drivers/pci/hotplug/TODO | 2 -- drivers/pci/hotplug/cpqphp_pci.c | 4 +++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/pci/hotplug/TODO b/drivers/pci/hotplug/TODO index 7397374af171..215ab36df11d 100644 --- a/drivers/pci/hotplug/TODO +++ b/drivers/pci/hotplug/TODO @@ -14,8 +14,6 @@ cpqphp: * A large portion of cpqphp_ctrl.c and cpqphp_pci.c concerns resource management. Doesn't this duplicate functionality in the core? =20 -* Returned code from pci_hp_add_bridge() is not checked. - ibmphp: =20 * Implementations of hotplug_slot_ops callbacks such as get_adapter_presen= t() diff --git a/drivers/pci/hotplug/cpqphp_pci.c b/drivers/pci/hotplug/cpqphp_= pci.c index 81c58b1ec200..34803f36ba65 100644 --- a/drivers/pci/hotplug/cpqphp_pci.c +++ b/drivers/pci/hotplug/cpqphp_pci.c @@ -100,7 +100,9 @@ int cpqhp_configure_device(struct controller *ctrl, str= uct pci_func *func) } =20 if (func->pci_dev->hdr_type =3D=3D PCI_HEADER_TYPE_BRIDGE) { - pci_hp_add_bridge(func->pci_dev); + if (pci_hp_add_bridge(func->pci_dev)) + err("bus/device/function %x/%x/%x: pci_hp_add_bridge() failed\n", + func->bus, func->device, func->function); child =3D func->pci_dev->subordinate; if (child) pci_bus_add_devices(child); --=20 2.53.0 From nobody Fri Sep 25 20:03:07 2026 Received: from mail-oi1-f181.google.com (mail-oi1-f181.google.com [209.85.167.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5BC9533030F for ; Wed, 9 Sep 2026 02:23:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788920585; cv=none; b=mn7rhYy61tdvHfUsqoTHjQJOds8EAdDKfshyKAf4xJpMpYx60DjNtXSPOegIY2kzihjL/OuP2Ze37viN503PsMzFOMuessV+QXJ/OY8K31o8gnk7WCZRPSKiNJKJeD7nuML1DcSa7/ds9c3HNNTazbyEJifQxZf4j62nKSeocKI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788920585; c=relaxed/simple; bh=BTT1HRR8Y8bxVmGOAFwMGT6IKlZ+/KjvH1QKz8C93JM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jwUzHwvtaWJD4ZVzns+pUlN7CZRMvkwfGWSyqfXyA77A7X/mLv3RASEnvliiZ1tnbyfkmuDu3sJzQsvdi8GpC7kbdFw3P7rDnUvLyc+y+NhVUEP+ibW/RR3RwouwWWz//IyC21AwZiplbgYptXUHmyeaXAcr/I/y/GkRH4iGbKc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QcrmIwTM; arc=none smtp.client-ip=209.85.167.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QcrmIwTM" Received: by mail-oi1-f181.google.com with SMTP id 5614622812f47-4a483a552efso2259965b6e.1 for ; Tue, 08 Sep 2026 19:23:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788920583; x=1789525383; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=qNFbGC6vHD9KVYO70GmfNmbHZwcxJjLkcoNakQKwQ9g=; b=QcrmIwTMX7ky7AoAC6elp3gRVmIjTk+AsAjWU3H8f7X/tEiyty5ljwnsNTrMz2g7vd WES0bygsOrO5Sj6kR6EDCIxKocwQ8+WcBw2pwdWiLHhiOPrOmg/angsHwyRSUZdWxjtd um8wZaCZ+nldd01m9Z4Jud7GqiF9I36FdvhEXtMWA2A5ioa6WiriAKqdR3OleMSJM4OT vy2oGNuopEvOwcSbi6vQQShlHSplJLbNAh1k6b+I+1BQlT1u2cu7WhQmBRhD/aol+Yzb IS9hBUBd7wV/YSSsrjXZNT0VJqCtSGnWblz/6xur4ENT0M+tvfG9yiJGVYcb/glCy2hE 3LBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788920583; x=1789525383; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=qNFbGC6vHD9KVYO70GmfNmbHZwcxJjLkcoNakQKwQ9g=; b=SubYQ2LsBf6FypRhJuykm3u2ArXQ7deQuykrm6h4fSa/DHuy7mzo7gXrkd4wW0b0vk lRTJbb4gfqkoq/icZnmt60Hy7QdSROmi36bqcT98zyL/ct3L1to6THvVRHmCdtQeepf/ Mvj19vabbxq2HMKkQTQC4ArhxXEbm9pWu0tn8NF6bwCTxrVncjD6lJ9VU/MggzxcHgee wq+vkZSIYY6aEYUJ8CjwOUPZWJJ6h1a797nxIAX8kCabsHswLVvCAbQZy0CGtCmNjHVn bTR4rPtA/JgtEYmhZuy775f7+7V5nGBbiRLbWRnIDX7ScKWKXYfsto9HIQPzR5dLXXEq 9B7A== X-Forwarded-Encrypted: i=1; AKwUvBxKLxhbp5MlnWvQLf0JkRmJHH+tpm4ekwJfqgUR7LOGO9lLCJvXv1760FydqycM/AyKMqg/uYoqsVAqmHU=@vger.kernel.org X-Gm-Message-State: AFuF++krMvMArWnmG4JJZJPWykGj/wYqtuR9v61KDpQYfbgJfBvci9g9 4EiQSJDXmIYs7bSlXXyT4fz5WolDjGx3GdUEi65GWD/UZ+nir2tCmPpD X-Gm-Gg: AYBFou39KZIvpcObdqmpnovmEBwxmiiNPMf+NHiO6r5zZmGa1iq2ynvBaGv00ih96cO bI7AG97EahtnsvxxV6uexgnaAnXGknL5M5lp3/fBieB99EnXpWtydINjbITmm3bGjVYmsy+88Qj 2iw7JX2WzYWKV8qugOMxYzcXRgvjXXPxBeWKmPPHTv/1lCndMvl526a/ohJB8rI6UsrqUnd22qm 4KRawJMohsyBXweAhy9c2f0VtvG/NiWTkgGjcK/Gp93GikgDFS5+TL/KkcbaPL5Y4+p/IChv4Hx XsDVH5zYZETUN+mEHvbJ16G2f0WlIxO5OQAB5M0H6bsoJrLFDNRjB8ygubvY19Y55ejpHyjkjpS wqqktRF2z9l1j5xwJ0M7H41aGas01n9TMlsyP7nmfsQ4pHS2OqQ2o5msgjW+5rQunhXgpe//2ML Cx/5k+dgSZACuOemFbF/ucRwl8g62LnSTca+zkE1O4BXFPJxkv0FO58HC27g0LFtcY4Cda96ukj IJGb0nwWr9sPLdmsE0J5hF3zg== X-Received: by 2002:a05:6808:1b23:b0:4b9:a88b:8885 with SMTP id 5614622812f47-4b9a88b903emr16330362b6e.27.1788920583238; Tue, 08 Sep 2026 19:23:03 -0700 (PDT) Received: from david-hassan-Inspiron-15-3567 ([69.162.230.54]) by smtp.gmail.com with ESMTPSA id 5614622812f47-4b971aa12cesm15580584b6e.16.2026.09.08.19.23.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2026 19:23:01 -0700 (PDT) From: Fahmy Hassan To: helgaas@kernel.org, bhelgaas@google.com, scott@spiteful.org Cc: fahmymohammed@gmail.com, kees@kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH v2 2/5] PCI: cpcihp: Check pci_hp_add_bridge() return value Date: Tue, 8 Sep 2026 20:22:23 -0600 Message-ID: <20260909022227.620217-3-fahmymohammed@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260909022227.620217-1-fahmymohammed@gmail.com> References: <20260909014143.GA123333@bhelgaas> <20260909022227.620217-1-fahmymohammed@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" cpci_configure_slot() calls pci_hp_add_bridge() for each bridge on the newly added slot without checking its return value. pci_hp_add_bridge() already logs an error for one failure path (no bus number available for the hot-added bridge), but returns silently if the bridge's subordinate bus isn't created after scanning -- that path goes completely unreported, and either way the caller currently has no way to notice or react to the failure. Log an error via the driver's existing err() macro when pci_hp_add_bridge() fails, identifying the device involved, and remove the now-resolved TODO entry. Signed-off-by: Fahmy Hassan --- drivers/pci/hotplug/TODO | 4 ---- drivers/pci/hotplug/cpci_hotplug_pci.c | 5 +++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/pci/hotplug/TODO b/drivers/pci/hotplug/TODO index 215ab36df11d..0a8e23546e5e 100644 --- a/drivers/pci/hotplug/TODO +++ b/drivers/pci/hotplug/TODO @@ -1,9 +1,5 @@ Contributions are solicited in particular to remedy the following issues: =20 -cpcihp: - -* Returned code from pci_hp_add_bridge() is not checked. - cpqphp: =20 * The driver spawns a kthread cpqhp_event_thread() which is woken by the diff --git a/drivers/pci/hotplug/cpci_hotplug_pci.c b/drivers/pci/hotplug/c= pci_hotplug_pci.c index 6c48066acb44..3deeec8dd206 100644 --- a/drivers/pci/hotplug/cpci_hotplug_pci.c +++ b/drivers/pci/hotplug/cpci_hotplug_pci.c @@ -269,8 +269,9 @@ int cpci_configure_slot(struct slot *slot) parent =3D slot->dev->bus; =20 for_each_pci_bridge(dev, parent) { - if (PCI_SLOT(dev->devfn) =3D=3D PCI_SLOT(slot->devfn)) - pci_hp_add_bridge(dev); + if (PCI_SLOT(dev->devfn) =3D=3D PCI_SLOT(slot->devfn) && + pci_hp_add_bridge(dev)) + err("pci_hp_add_bridge(%s) failed", pci_name(dev)); } =20 pci_assign_unassigned_bridge_resources(parent->self); --=20 2.53.0 From nobody Fri Sep 25 20:03:07 2026 Received: from mail-oi2-f12.google.com (mail-oi2-f12.google.com [74.125.231.204]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D0241332637 for ; Wed, 9 Sep 2026 02:23:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.231.204 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788920589; cv=none; b=mBLjNi6icVvR6EFY2TzdVxRCpjtgd3LG5PgtbWAT8BRZoEz5XKTji+bF+N0pjBMqXF8BDAbeVSdmwDYwwfXOj+EprmX7iZSpwGvlA0E0g1ZO5IujQOmWkJGTu5Vjz7zAVd8WcpdG+qTBh9XpwQ37YhzSDgo0jrExQz/N69188qE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788920589; c=relaxed/simple; bh=FXYFbsvoiFhk1q+I1uqhaYrKpSuZspiFtFBBT4QeP4o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=F/axUYfaK+z2T8tNxwtWKRVBJdDJzh07PsE4SzudnlopOc8iBWEpfWudq+UMjlDu6dkOcIJphKT4Bav4Wxol1/+js9QS+CGlmf2anedjMwyqPt1lZOFnLinDo8NzdZ8SjqBbyKAgilqeAZnc0slwMatln7UJn+eQ1jqGkmaTryw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=G1U2IPyt; arc=none smtp.client-ip=74.125.231.204 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="G1U2IPyt" Received: by mail-oi2-f12.google.com with SMTP id 5614622812f47-4b37a39a42cso427441b6e.1 for ; Tue, 08 Sep 2026 19:23:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788920587; x=1789525387; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=znjeT4imZ23diH25LsOBsldTABCrj4MWNj4yVI5JNVM=; b=G1U2IPytDx3wjr7RSblPBkQQKpE8cOk30XnMmJDX+F8cvKBEMjKAtLTAOoo4zHhuSF 7OEy6doGRnT1cJVxjVA1PQcHOXpomhAK7CmufRMRUiTgLdCrXdlnpXI0SJxQJs6znBdB sWOdKjmXr/0fhX/WxbTeYZ21HMaWzND8jCE6Y++yZSWZtN1DleC9LW2Zdkb03N3RbS7f U7eUi8Iwt4U5H/fbxkr/uc+4GliU7UXJax+i2SCQ5fAnImTpOxu2r3LSQ7S+XgFsNUL8 jjwDHDOL+bKJCtcqR+a2H6ao8QCWHykB3mdlSMP0EZj0Vwl7+VwvzT6mUcI0rLijz5BY 2BYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788920587; x=1789525387; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=znjeT4imZ23diH25LsOBsldTABCrj4MWNj4yVI5JNVM=; b=CtYn8ib6taHKASeOyQqXIan7uZn/AwyKxH7Ac3PqmqwfgariQsTb9t8zNCjnO5yF0Z 6VWe7AijAKTc7ZaCRiNYdnh/NtvYDdOZNh09VpsOtbHzCUlBLljyK0PIsBb0gODeVj1L leYuWwB36wXPCtyeDSrKFsfBWYwIMYwjh9Pchs5MOANtkBQV9FFojsID1Tzm3qrdO/kq zHCvvz2VIbAmH3K8OTAxAE0tf0oluWpSLB/nxbqIOSQhVOGmm7gyDkdCHXUQKfgvE6ag EkRdKkUavqJHpA2oXRCbgMDC7uS9ec1M/zxlANB2HGXqJb1kU8xwwG8dF1rvDEqSdIhG 4NLg== X-Forwarded-Encrypted: i=1; AKwUvBwMjDQJs0AQCOf2zfF4CZgq6V90ON0ef5izBwek+JlvbdjDbRQaOWaUTIOfsGiMWR6xeUwVaAoR695Hgl8=@vger.kernel.org X-Gm-Message-State: AFuF++n/gDo2M9PKIJbyi5dpN1V0OTQHnRLtKBRAFT/MFxrZPySInCLB yzUqLKeQ2VZQVvq6Y6LA4nbCiCWumeHvUtsOGYec5rs2P2J7LI8KLSzm X-Gm-Gg: AYBFou05vlyZIwKCp0aJvrEKqamU1I+q431NVabEMreUXTteqJiSZleRpyAW4j217Ba fiRZr7FcBO6MJk/lgWs6SWfkz4GXCMos0BUKOpFViN8UowkrPY0hhyWU9TURAj8za+1tNVm43/f ZjtIIGdyM1T23xu3LMUNHg1TCJagh4LN5k1wtkaHDYyenGTPnQ3AfcONs+x4hGQJTSKMM/pVJ7n QXdPXTw0TUTmvaW8uNCPIOGao4i54OIkoMo7v0A3KBVEVupELkAy7LfyyMtenzfjCHiEqX5SrGa fjAC4KS2wwXrBs4xjja0diSWghSi4e5xExD582z6C9w5s3kJHjwEhGsgsIkIMeqi6Yi/5+LjrxC BwG00hRVpeBx2IdjifnWFnGTFcA80Rt9h6mXkaaywjQu5RxhuAQhukDw+HhaqsWBc88TOob+Dwb sKX1h6YUMX8KIZHPV9UGWyx6fD+ZNmvvJYVnBXqfo625rvcDNFzc5BakJLlLKVqApODgj/iQlP0 +fReICYFJ8wDpjn7TVPzMYAEQ== X-Received: by 2002:a05:6808:4fca:b0:4b3:3e1:499b with SMTP id 5614622812f47-4be85742f01mr5065747b6e.6.1788920586712; Tue, 08 Sep 2026 19:23:06 -0700 (PDT) Received: from david-hassan-Inspiron-15-3567 ([69.162.230.54]) by smtp.gmail.com with ESMTPSA id 5614622812f47-4b971aa12cesm15580584b6e.16.2026.09.08.19.23.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2026 19:23:04 -0700 (PDT) From: Fahmy Hassan To: helgaas@kernel.org, bhelgaas@google.com, scott@spiteful.org Cc: fahmymohammed@gmail.com, kees@kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH v2 3/5] PCI: ibmphp: Check pci_hp_add_bridge() return value Date: Tue, 8 Sep 2026 20:22:24 -0600 Message-ID: <20260909022227.620217-4-fahmymohammed@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260909022227.620217-1-fahmymohammed@gmail.com> References: <20260909014143.GA123333@bhelgaas> <20260909022227.620217-1-fahmymohammed@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" ibm_configure_device() calls pci_hp_add_bridge() without checking its return value. pci_hp_add_bridge() already logs an error for one failure path (no bus number available for the hot-added bridge), but returns silently if the bridge's subordinate bus isn't created after scanning -- that path goes completely unreported, and either way the caller currently has no way to notice or react to the failure. Log an error via the driver's existing err() macro when pci_hp_add_bridge() fails, identifying the device involved, and remove the now-resolved TODO entry. Signed-off-by: Fahmy Hassan --- drivers/pci/hotplug/TODO | 2 -- drivers/pci/hotplug/ibmphp_core.c | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/pci/hotplug/TODO b/drivers/pci/hotplug/TODO index 0a8e23546e5e..2a4f44f9b629 100644 --- a/drivers/pci/hotplug/TODO +++ b/drivers/pci/hotplug/TODO @@ -37,8 +37,6 @@ ibmphp: * A large portion of ibmphp_res.c and ibmphp_pci.c concerns resource management. Doesn't this duplicate functionality in the core? =20 -* Returned code from pci_hp_add_bridge() is not checked. - shpchp: =20 * The hardirq handler shpc_isr() queues events on a workqueue. It can be diff --git a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp= _core.c index aca86c092d4a..b653d3068677 100644 --- a/drivers/pci/hotplug/ibmphp_core.c +++ b/drivers/pci/hotplug/ibmphp_core.c @@ -690,7 +690,8 @@ static int ibm_configure_device(struct pci_func *func) } } if (!(flag) && (func->dev->hdr_type =3D=3D PCI_HEADER_TYPE_BRIDGE)) { - pci_hp_add_bridge(func->dev); + if (pci_hp_add_bridge(func->dev)) + err("pci_hp_add_bridge(%s) failed\n", pci_name(func->dev)); child =3D func->dev->subordinate; if (child) pci_bus_add_devices(child); --=20 2.53.0 From nobody Fri Sep 25 20:03:07 2026 Received: from mail-oi1-f177.google.com (mail-oi1-f177.google.com [209.85.167.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 80BEB33557D for ; Wed, 9 Sep 2026 02:23:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788920592; cv=none; b=hw+7j+zEhQh8ziFqDOCf2Q0c1/c5tchBrH5FQHnOmXo0Ye0FB9xdAUpUzM5/ny/oVRpCXWJLxkmkA5brhl2AcPmqvoRLaVouSh2DsDO9hutFDq6YWOK9s51o4RvOC3XKzUSbk3ShL+huLsRVnsheSyOJeSFYx7wi2li/Bp0Sp2U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788920592; c=relaxed/simple; bh=Dh4B4IzBPL7G0fg8fsHyxThTQYw6KbQHxvakwyfWBas=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bhnAYj4dJimFKqoPxxhNqrfKWD5zQS6tzO2DYeGR9c8rDsDuG/GUvP9tLr2cbnPLTbZ4mDSss5QHlK1UnWWIpU1vStVyfP1pQ3gDnlW1xKox3qlqPdon98u2QTBB8rjf5CAYNf27+2gdmaSdZmVtHtIiXn2T78Xiz5Tj5m45SrE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=HasV1NKi; arc=none smtp.client-ip=209.85.167.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HasV1NKi" Received: by mail-oi1-f177.google.com with SMTP id 5614622812f47-4a46a53abc9so4222162b6e.3 for ; Tue, 08 Sep 2026 19:23:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788920590; x=1789525390; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=SfaK6q6dasszOEuAIXJYECUIBADGH/4esaoa8zE8RWA=; b=HasV1NKiXEoXc340eAcAdvP8oHevuWh3o4wkLhthHKYorK+y1/vqV/VkGTojcnRQw4 htzHbyeEt5DXeAbdxD3e4ohL43u3a5tBejj93kjesCC9WawgcisCncIfXnqoA83SGzuH KKXmNwAQFys14Qog42faVcalDFxpaxt9voDK1o3DnBIEA0RMt3HOeUxGmJYrUwL5Mhn7 5izAv20kuNU94W8NWZHSYZ5s8gcigakX/Y94Q+ksZy+UbBWl0wwES56KipMQmcE3RY2a IyAhORqMngoju24VsKX8KxTf2Acghg3VsO+i1tn1t8XI6LWmxuqTvETeL8+iB7T1NViG idQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788920590; x=1789525390; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=SfaK6q6dasszOEuAIXJYECUIBADGH/4esaoa8zE8RWA=; b=Hvj5d2cIH5zFOpnmAETeFiyZFBAXs14vNiunTlBQ3GKziSQD2cHVSHTCxpY28Xk1V2 ovBJlQhCLAb1yLyDFbhYvaIhoaG1OtFnB7yleYs6xShr6+g1eb3A55qtjiBDBLCe8JdI VOewPR/JSNikq1kOKPy4bEzyxd6cpSdBYi4zt7D0FIkZHULFCvsHRccnV1pcbKyRgiBu JUjvbjPob7ax+J0PoxwwDW4hAlxak9zwEd5yq6X/nqNxQwR4bHVWmzu8chCUVhbE3qx0 RspCbk1XaBYKnKg5w0FxiH5SPH6ybBgEcrbjK618SHlK+249OB0mdBe2FPhktSq2aDPY aHDw== X-Forwarded-Encrypted: i=1; AKwUvByvR/FIukk67oBYJROHCJKNTg2zJYr2Z4v4dk7Hb7/VPOclpuBcvQEu4tR+9kAm/vXddISqQWUeTphS5bg=@vger.kernel.org X-Gm-Message-State: AFuF++lMqPFnnAwKcK6O6JABJ2JCRAegpxuU5r3CO+QSvIZHBzLm4uL2 NX5b3hajHpBOclp1KWw1S4EaXL+VPoRKI8YrYxyvmBxu4iBxZtv4yu5/ X-Gm-Gg: AYBFou3vxmzj15oAn3vtJD4r3iOkYBW4DT+cGnP0BCau5d56ZUkRF+ow5DSwvkt53mw JDAOSKmp78RW81/imdOYQMG9a11gLIk53cNQ6hzROMS2aiqceAaffojPMoTNo3a8lueKALk974s Dh5FFfkfZt8ykJxH//X0qWwQuy3qup7ubEOh16AlsRcuboUBEa4wBAi2RDOvCSc6MzM6I9a/3f+ 9cri+8IFlSivc/mCHrcMgyxDRUG9n9M7dQqABp1LwDDjBP1VDZAiD2ep7xTH7tn2ng0WNoqchtf KgjpTGI2wO/lyRBU7JiRKQ3vpO0atyZpP6p01XvRYXSVtXevmkCJb/kDva1GIZ/LHLsSstKC8u7 6Bts+WtLOIWWZpNW7jXuIvVqbC7G8cjTc2KUhbu/LTaR/Dz/y7qY4yXnm9JgCmOGxmla80LAcr3 m83biPhvr/Mxrgyz14JX7mIkcbk0vuHJKi2a/qIgCFQPLPLQ69MD9f2S6ibSUnyHL13woxn0/Q7 E7QhmtirzU39gUA58vZqPj3gg== X-Received: by 2002:a05:6808:c2fa:b0:4b9:e5fa:8909 with SMTP id 5614622812f47-4b9e5fa8d8bmr15799308b6e.28.1788920590066; Tue, 08 Sep 2026 19:23:10 -0700 (PDT) Received: from david-hassan-Inspiron-15-3567 ([69.162.230.54]) by smtp.gmail.com with ESMTPSA id 5614622812f47-4b971aa12cesm15580584b6e.16.2026.09.08.19.23.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2026 19:23:08 -0700 (PDT) From: Fahmy Hassan To: helgaas@kernel.org, bhelgaas@google.com, scott@spiteful.org Cc: fahmymohammed@gmail.com, kees@kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH v2 4/5] PCI: pciehp: Check pci_hp_add_bridge() return value Date: Tue, 8 Sep 2026 20:22:25 -0600 Message-ID: <20260909022227.620217-5-fahmymohammed@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260909022227.620217-1-fahmymohammed@gmail.com> References: <20260909014143.GA123333@bhelgaas> <20260909022227.620217-1-fahmymohammed@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" pciehp_configure_device() calls pci_hp_add_bridge() for each bridge on the newly added slot without checking its return value. pci_hp_add_bridge() already logs an error for one failure path (no bus number available for the hot-added bridge), but returns silently if the bridge's subordinate bus isn't created after scanning -- that path goes completely unreported, and either way the caller currently has no way to notice or react to the failure. Log an error via the driver's existing ctrl_err() macro when pci_hp_add_bridge() fails, identifying the device involved. Signed-off-by: Fahmy Hassan --- drivers/pci/hotplug/pciehp_pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/pci/hotplug/pciehp_pci.c b/drivers/pci/hotplug/pciehp_= pci.c index 65e50bee1a8c..cbdfde557f3b 100644 --- a/drivers/pci/hotplug/pciehp_pci.c +++ b/drivers/pci/hotplug/pciehp_pci.c @@ -59,7 +59,8 @@ int pciehp_configure_device(struct controller *ctrl) } =20 for_each_pci_bridge(dev, parent) - pci_hp_add_bridge(dev); + if (pci_hp_add_bridge(dev)) + ctrl_err(ctrl, "pci_hp_add_bridge(%s) failed\n", pci_name(dev)); =20 pci_assign_unassigned_bridge_resources(bridge); pcie_bus_configure_settings(parent); --=20 2.53.0 From nobody Fri Sep 25 20:03:07 2026 Received: from mail-oi1-f179.google.com (mail-oi1-f179.google.com [209.85.167.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D784C30C37A for ; Wed, 9 Sep 2026 02:23:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788920596; cv=none; b=OXE2oMCeSefUsINKNOglCZYMlVwI5vvyIupKpemaxGnjjE6vMp11YCkthV66jbiMspnYoC1TNWOPKLsiquXbxl7pE3R6Avnuk9RoymRhSMUTQetJBT1YKP54YxpRBzTgrUhd/Cjox8sHBXmd8OJj5e4Do7hwvVwybJe3SR9rlM0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788920596; c=relaxed/simple; bh=OlnxTMf1OS7EffZSZon0z25ejT2la63Mm23HWuKKSfc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iJ9fNVQcB8TcQA8yndqCX4Im96567shcKn88YHQcfa9p0lVQDvpo5erpWNE8g9g3xQ56vbi8tnOFmgFvy31p/pakBENePj/zJ8rEqlFG7QGdcmXSs4JvYjsUGwRnR8CiCCb+esRJyv/0I0q/LE4tcN3X1zRtzgv7IosC5fdorDI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=VrgeDPVI; arc=none smtp.client-ip=209.85.167.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VrgeDPVI" Received: by mail-oi1-f179.google.com with SMTP id 5614622812f47-4be07e7c54dso1380790b6e.1 for ; Tue, 08 Sep 2026 19:23:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788920593; x=1789525393; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=JAgTxvl/DOmwjv6Cc0tmXlZdkUKiZ0mQGF7jFKNHR0w=; b=VrgeDPVIYMLoY/NWVzLr6GrRpjoeKCxlQ8MuzMLYnZG3YIFFOzWz1lsEIpjGECC+bJ tk5asnKpp3AuBDc8uFOTLMFwz6i20AXz06ao9a3pHLkWGNo3fD6C5NTr8CjKsr7MAGBY eoIWNrkilXaIFGK22msIqeevNcKOI7+lT0g8OxHZ2+2tQdANLThWAmzJoouoTZQxTwHX e6/Yn4CSvtCntUu/z3Uon5XJ0wLsoaMbe8WFVeTv5FndSUV7T/sfswG8v2CGMYKuqGpe bXD6gk9gvYxRIqi/taqCoKXN8yq0OGRwKKlpTp/6K2sT9FxVXcIWbs+uOacuVXyvgMqO GO0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788920593; x=1789525393; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=JAgTxvl/DOmwjv6Cc0tmXlZdkUKiZ0mQGF7jFKNHR0w=; b=ESXaCEdaqbfuPZJA1moJcM3zlahn8699tq1MaY+TUB6de4juJ/0LYbrhzrsZajsW8j C/fb+YCLmK6i5hH4r9KesSsfZrSAUiGboW/jLNxcPh+gRflLqKcxqIFeC3ZyewIenF+t 1TS6NSOYPGS5EnUjFLupqL6WAc9k0zCvayTDcCq5WjXgyceDwiEvUvdhoaiREnwwuAyg XZU0AKZ/big/yhav4kYJBOhMEyYdSaSZE9pzDh8UXODqcFhPcapBPEdHqOSC9sTYAXtl iL6kOlgC85V3X3OcLKDIM5SDuBNL6Sv32kDefpm7X93r3juLTUO0f9jEjUqHZUOE51Iv KYDQ== X-Forwarded-Encrypted: i=1; AKwUvBxCouGE9u9a/3gparaVSaXRmrc7sZ2sZ7hfVGD/6yXdHZ+2++kwMiWu4wzgfuio7JxKbXelqzFCt0olRLw=@vger.kernel.org X-Gm-Message-State: AFuF++lzyAfjsYB6rD9e/iTvdl9uz747BPZzLMKw05Wg8jhf4s6E+ynx fuVe/Lawiymiw3iABZGJIW/L6AcLmb6ODr+0CBKi8l5jN4fJxGxuwJbE X-Gm-Gg: AYBFou12WuMtHV4saueIT4/2CE9a1baQQ4AXBzeMO6AwWSp0/5XKPKBhRgUUqL88ujN pRSqsd21MhG6H49+9HzP9PLhEYgbeDUowC2vMrQv16tvcsvyRrI/gjlWcTTYEBNuXlQZzvyga3C 4iAXAMOSLq8Ni9QMCklhh72uoKdRcfxMSECYWcnTdzmmxQLNHHvoi91vFimPN+6iiaxqMT6b/4D ol/2M29GRBY57gjju4qf+wEScbiSfRKO2QBfPxWcuhFYYPIbzu9NzCBmwMxknd7XPlck7CSf8Ml 2ZKeqQW8b0DVfzxt8UNSWcbKQwvEY9flqE2dzK+YnSkRox4NLO3/tGSWZXX2AZmIuY18FYGdUqj v7E44rGoWACzJTpIJZF+yjgSFxtsP7iiQVLuiRRmsk878F869HZrsFVI9kjjmNKSoOjorkpCG4O BKiLabuXyjIi0GTxd2xw9/B4fhHi6KTJeb58S9fJO+8BSmRddRvTqN4/vytGClTqTs9c/xzR1Yu 3UameL/m7ya3mCC7AW+pztDew== X-Received: by 2002:a05:6808:c1fc:b0:4b8:4703:db93 with SMTP id 5614622812f47-4b84703dc46mr13211353b6e.28.1788920593574; Tue, 08 Sep 2026 19:23:13 -0700 (PDT) Received: from david-hassan-Inspiron-15-3567 ([69.162.230.54]) by smtp.gmail.com with ESMTPSA id 5614622812f47-4b971aa12cesm15580584b6e.16.2026.09.08.19.23.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2026 19:23:11 -0700 (PDT) From: Fahmy Hassan To: helgaas@kernel.org, bhelgaas@google.com, scott@spiteful.org Cc: fahmymohammed@gmail.com, kees@kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH v2 5/5] PCI: shpchp: Check pci_hp_add_bridge() return value Date: Tue, 8 Sep 2026 20:22:26 -0600 Message-ID: <20260909022227.620217-6-fahmymohammed@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260909022227.620217-1-fahmymohammed@gmail.com> References: <20260909014143.GA123333@bhelgaas> <20260909022227.620217-1-fahmymohammed@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" shpchp_configure_device() calls pci_hp_add_bridge() for each bridge on the newly added slot without checking its return value. pci_hp_add_bridge() already logs an error for one failure path (no bus number available for the hot-added bridge), but returns silently if the bridge's subordinate bus isn't created after scanning -- that path goes completely unreported, and either way the caller currently has no way to notice or react to the failure. Log an error via the driver's existing ctrl_err() macro when pci_hp_add_bridge() fails, identifying the device involved. Signed-off-by: Fahmy Hassan --- drivers/pci/hotplug/shpchp_pci.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/pci/hotplug/shpchp_pci.c b/drivers/pci/hotplug/shpchp_= pci.c index 36db0c3c4ea6..b9b18879b8ab 100644 --- a/drivers/pci/hotplug/shpchp_pci.c +++ b/drivers/pci/hotplug/shpchp_pci.c @@ -48,8 +48,9 @@ int shpchp_configure_device(struct slot *p_slot) } =20 for_each_pci_bridge(dev, parent) { - if (PCI_SLOT(dev->devfn) =3D=3D p_slot->device) - pci_hp_add_bridge(dev); + if (PCI_SLOT(dev->devfn) =3D=3D p_slot->device && + pci_hp_add_bridge(dev)) + ctrl_err(ctrl, "pci_hp_add_bridge(%s) failed\n", pci_name(dev)); } =20 pci_assign_unassigned_bridge_resources(bridge); --=20 2.53.0