lkml.org 
[lkml]   [2021]   [Nov]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH v4 1/5] PCI: Handle NULL value inside pci_upstream_bridge()
Date
Return NULL if a NULL pointer is passed into pci_upstream_bridge().

Signed-off-by: Saheed O. Bolarinwa <refactormyself@gmail.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
\
 
 \ /
  Last update: 2021-11-07 17:31    [W:0.040 / U:0.476 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site