From: "Saheed O. Bolarinwa" <refactormyself@gmail.com>
To: helgaas@kernel.org
Cc: "Saheed O. Bolarinwa" <refactormyself@gmail.com>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [RFC PATCH v4 1/5] PCI: Handle NULL value inside pci_upstream_bridge()
Date: Sun, 7 Nov 2021 17:29:37 +0100 [thread overview]
Message-ID: <20211107162941.1196-2-refactormyself@gmail.com> (raw)
In-Reply-To: <20211107162941.1196-1-refactormyself@gmail.com>
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
next prev parent reply other threads:[~2021-11-07 16:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-07 16:29 [RFC PATCH v4 0/5] Remove unncessary linked list from aspm.c Saheed O. Bolarinwa
2021-11-07 16:29 ` Saheed O. Bolarinwa [this message]
2021-11-07 16:29 ` [RFC PATCH v4 2/5] PCI/ASPM: Remove struct pcie_link_state.parent Saheed O. Bolarinwa
2021-11-07 16:29 ` [RFC PATCH v4 3/5] PCI/ASPM: Remove struct pcie_link_state.root Saheed O. Bolarinwa
2021-11-07 16:29 ` [RFC PATCH v4 4/5] PCI/ASPM: Remove struct pcie_link_state.downstream Saheed O. Bolarinwa
2021-11-07 16:29 ` [RFC PATCH v4 5/5] PCI/ASPM: Remove unncessary linked list from aspm.c Saheed O. Bolarinwa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211107162941.1196-2-refactormyself@gmail.com \
--to=refactormyself@gmail.com \
--cc=helgaas@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).