[RFC PATCH v3 1/5] PCI: Handle NULL value inside pci_upstream_bridge()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Return NULL if a NULL pointer is passed into pci_upstream_bridge().

Signed-off-by: Saheed O. Bolarinwa <refactormyself@xxxxxxxxx>
---
 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




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux