[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211107162941.1196-2-refactormyself@gmail.com>
Date: Sun, 7 Nov 2021 17:29:37 +0100
From: "Saheed O. Bolarinwa" <refactormyself@...il.com>
To: helgaas@...nel.org
Cc: "Saheed O. Bolarinwa" <refactormyself@...il.com>,
linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [RFC PATCH v4 1/5] PCI: Handle NULL value inside pci_upstream_bridge()
Return NULL if a NULL pointer is passed into pci_upstream_bridge().
Signed-off-by: Saheed O. Bolarinwa <refactormyself@...il.com>
---
include/linux/pci.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index cd8aa6fce204..b087e0b9814e 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -695,6 +695,9 @@ static inline bool pci_is_bridge(struct pci_dev *dev)
static inline struct pci_dev *pci_upstream_bridge(struct pci_dev *dev)
{
+ if (!dev)
+ return NULL;
+
dev = pci_physfn(dev);
if (pci_is_root_bus(dev->bus))
return NULL;
--
2.20.1
Powered by blists - more mailing lists