From nobody Fri Apr 17 00:19:06 2026 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (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 0B34027C84B for ; Tue, 24 Feb 2026 18:01:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771956115; cv=none; b=ok9rMNGLzKpFuf3jprhgiWRPGW1Jl+wGa4uIKCusVzkmG1tF/SmyVPMXe/OeZ+Kv8KFyagX9OvhCjm5SD9N6NtJV3a/OrKvT5ikq+IP5kjykWtYWekKJhgOT1QRhJUl8E3RUPHquR0t3xHR15tJGu9oFI94EG0KVA0wID67Lo3U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771956115; c=relaxed/simple; bh=yDVL4gKAZypp4ppC8zaZWRGpGoKycdHdgbImNQyCUOA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=J3/kA3SMhR6Qt9yz3HSSGLBScAP+1yNYI7c7VtqvwjOVae82D58NOLUnJF1jVmUkB+srNmMjqq7AdgcQJSIXraIQda9aCV7SM4PUzWc56j9v7dkDXKnDv2KRa6TH7A0oeHXfqhqBnxyFr5Fy1Wi/e1MkjAjYUldQAV+8DeKwIsA= 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=ObnkEYUr; arc=none smtp.client-ip=209.85.128.42 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="ObnkEYUr" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-4807068eacbso45767325e9.2 for ; Tue, 24 Feb 2026 10:01:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771956112; x=1772560912; 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; bh=wkG3SLuYSM5Di7ZiQlKD8ev6UndxJoHprPyam9JLEWo=; b=ObnkEYUrtgUOMjpytkmS4qU2XlK8M9UN/5FIvkOczvgyTAYiwgT1w1Uu2jqXBJW8uE dgHccnWNeyzWZuuAM7SlQRYO61p5nmp7qnBu6FY8sIfcV9fhPoOpcWFQRNDzzUYSKhsw 0mUcV5o4VYwgMj8ltOY+57U+N7yxoXeJtLJYwdOR/4RP/2szDDks5eeHDlNOMt+cre4n E0/i2O+h/jJafXu4DNUmP11dLE1CEqHRv/4Oz0581sT0oPY42SErbO7SQGjdaTgVVA/w fds/dub8nYAbU4gmfcXW83kh3pQvlVWP3JYjuNm/cWpq9zqFus56/8QgPvBCWvydQt3M GyoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771956112; x=1772560912; 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; bh=wkG3SLuYSM5Di7ZiQlKD8ev6UndxJoHprPyam9JLEWo=; b=WvpNSM8IrRw9NavJlE3HwD8kbZxNHwO105EWWEECZcIxVbpVESUvSvWDfPO9T/BU8q RNte6/EU6+vJ5piitqfNzqd5+CSfHnuipq7Ye/mE4gxL/p1etcqzKhIE0JOh7LTya2L9 upNwlUrRewI3zkvwk+E97HT+Y3oPbxbwKBn5rj1lO2PHO+gJQbWrXRoaZc3VaMeFxKnt nNe12VOb5RM80WFd40EV9a4uaHN9fKZyw2u7RygL/pTHIiQCy/Z1gUJyfnp0HM6SHq45 j8QTXBUtcFSSnvaGHHAz9/hlksqGe+QgJTrA9okhjCW46yKqoO3iCM3CKHvCcGucss/3 gglg== X-Gm-Message-State: AOJu0YwNGzQI12ZFXSnzEVtrDdp3OY6My4+BQ3ahY5J+mgMDnbGWqrr6 EGWIUQysiklhSnXvgxr20Nl9vECgvK+qQzWlI1X620KHQdKKnrgDGOWN X-Gm-Gg: AZuq6aJQgqCofHN5csDn1cgvRbOLi8T1ehzW46vQ5D5IUEahUHkslOOtBtlZXem9h7m mSQLXLRzaCJXnfgM+APAdj4oEikOoMbWr2mtqW1VI6xl3a1iNLzbvUX6SyuxXSjZmguXZ1bUH9s jDqXPvMm8mSq+xSxYeo1hboBqLa2lo+4SQ6BHbavFqkajIT8Z8qpmhc9uZgslO7zpFeORGCIdtb 5DKrdw8Blas+8OhPnrEYLj+GX9iDfbzz/PEe1J+KDlz62h31HdnNepJbnjy/S9LUtyBsJyQnMAO FA63lJaayr7p7gZg0yoVS9FdoAhVDPlpcDr3k68Sl60t3Lsf8nGIXLd6s6Iy3glROrStnIIv0Pm yNo6N4SyRHU5s0LhLxbuPXhrGGEf9BvR3Mboj7pVoxqbVDpEyyKSjYhJv1p4lX3eikrc7m7P3q7 1oXjZGkgpzdhHxqkq8Emy2ru39NSL2XMt4T8LRGragXe/Tl12j7dzS X-Received: by 2002:a05:600c:3508:b0:46e:4e6d:79f4 with SMTP id 5b1f17b1804b1-483a95bf3d0mr244077395e9.15.1771956112226; Tue, 24 Feb 2026 10:01:52 -0800 (PST) Received: from LAPTOP-B9QI2C1K.localdomain ([31.205.125.101]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-483bd6854c7sm42260965e9.0.2026.02.24.10.01.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Feb 2026 10:01:51 -0800 (PST) From: Majed Alkhaleefah To: bhelgaas@google.com Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, scott@spiteful.org, Majed Alkhaleefah Subject: [PATCH v2] PCI: hotplug: Change return type of pci_hp_add_bridge() to void Date: Tue, 24 Feb 2026 18:00:37 +0000 Message-ID: <20260224180036.361502-2-majedalkhaleefah@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260223023645.344137-2-majedalkhaleefah@gmail.com> References: <20260223023645.344137-2-majedalkhaleefah@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" The function pci_hp_add_bridge() currently returns an int error code. However, none of its callers actually check or store the return value, neither do they need to take any special action in the event of a failure. The execution path of pci_hp_add_bridge() already contains relevant error logging. Therefore, adding additional logging/error checking is redundant. Make pci_hp_add_bridge() a void function. Compile-tested only. Suggested-by: Bjorn Helgaas Signed-off-by: Majed Alkhaleefah --- Thank you for the review. Looking at the path of pci_hp_add_bridge(), adding additional error checking is indeed redundant, and the function could just be made to return void. Changes in v2: - Drop the v1 approach of checking the return value of pci_hp_add_bridge() in cpci_configure_slot() - Remove relevant TODO items - Make pci_hp_add_bridge() a void function drivers/pci/hotplug/TODO | 8 -------- drivers/pci/pci.h | 2 +- drivers/pci/probe.c | 9 ++------- 3 files changed, 3 insertions(+), 16 deletions(-) diff --git a/drivers/pci/hotplug/TODO b/drivers/pci/hotplug/TODO index 7397374af171..2a4f44f9b629 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 @@ -14,8 +10,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() @@ -43,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/pci.h b/drivers/pci/pci.h index 13d998fbacce..ee35f5582688 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -353,7 +353,7 @@ static inline int pci_proc_detach_bus(struct pci_bus *b= us) { return 0; } #endif =20 /* Functions for PCI Hotplug drivers to use */ -int pci_hp_add_bridge(struct pci_dev *dev); +void pci_hp_add_bridge(struct pci_dev *dev); bool pci_hp_spurious_link_change(struct pci_dev *pdev); =20 #if defined(CONFIG_SYSFS) && defined(HAVE_PCI_LEGACY) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index bccc7a4bdd79..b4270e44a769 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -3545,7 +3545,7 @@ void __init pci_sort_breadthfirst(void) bus_sort_breadthfirst(&pci_bus_type, &pci_sort_bf_cmp); } =20 -int pci_hp_add_bridge(struct pci_dev *dev) +void pci_hp_add_bridge(struct pci_dev *dev) { struct pci_bus *parent =3D dev->bus; int busnr, start =3D parent->busn_res.start; @@ -3558,7 +3558,7 @@ int pci_hp_add_bridge(struct pci_dev *dev) } if (busnr-- > end) { pci_err(dev, "No bus number available for hot-added bridge\n"); - return -1; + return; } =20 /* Scan bridges that are already configured */ @@ -3572,10 +3572,5 @@ int pci_hp_add_bridge(struct pci_dev *dev) =20 /* Scan bridges that need to be reconfigured */ pci_scan_bridge_extend(parent, dev, busnr, available_buses, 1); - - if (!dev->subordinate) - return -1; - - return 0; } EXPORT_SYMBOL_GPL(pci_hp_add_bridge); --=20 2.43.0