From: Alexandru Elisei <alexandru.elisei@arm.com>
To: will@kernel.org, julien.thierry.kdev@gmail.com, kvm@vger.kernel.org
Cc: andre.przywara@arm.com, sami.mujawar@arm.com,
lorenzo.pieralisi@arm.com, maz@kernel.org,
pierre.gondois@arm.com
Subject: [PATCH v2 kvmtool 2/4] arm/fdt.c: Don't generate the node if generator function is NULL
Date: Mon, 21 Jun 2021 10:21:26 +0100 [thread overview]
Message-ID: <20210621092128.11313-3-alexandru.elisei@arm.com> (raw)
In-Reply-To: <20210621092128.11313-1-alexandru.elisei@arm.com>
Print a more helpful debugging message when a MMIO device hasn't set a
function to generate an FDT node instead of causing a segmentation fault by
dereferencing a NULL pointer.
Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com>
---
arm/fdt.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/arm/fdt.c b/arm/fdt.c
index 02091e9e0bee..7032985e99a3 100644
--- a/arm/fdt.c
+++ b/arm/fdt.c
@@ -171,7 +171,12 @@ static int setup_fdt(struct kvm *kvm)
dev_hdr = device__first_dev(DEVICE_BUS_MMIO);
while (dev_hdr) {
generate_mmio_fdt_nodes = dev_hdr->data;
- generate_mmio_fdt_nodes(fdt, dev_hdr, generate_irq_prop);
+ if (generate_mmio_fdt_nodes) {
+ generate_mmio_fdt_nodes(fdt, dev_hdr, generate_irq_prop);
+ } else {
+ pr_debug("Missing FDT node generator for MMIO device %d",
+ dev_hdr->dev_num);
+ }
dev_hdr = device__next_dev(dev_hdr);
}
--
2.32.0
next prev parent reply other threads:[~2021-06-21 9:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-21 9:21 [PATCH v2 kvmtool 0/4] arm/arm64: PCI Express 1.1 support Alexandru Elisei
2021-06-21 9:21 ` [PATCH v2 kvmtool 1/4] Move fdt_irq_fn typedef to fdt.h Alexandru Elisei
2021-06-21 9:21 ` Alexandru Elisei [this message]
2021-06-21 14:03 ` [PATCH v2 kvmtool 2/4] arm/fdt.c: Don't generate the node if generator function is NULL Andre Przywara
2021-06-21 9:21 ` [PATCH v2 kvmtool 3/4] arm/arm64: Add PCI Express 1.1 support Alexandru Elisei
2021-06-21 14:04 ` Andre Przywara
2021-06-23 9:32 ` Alexandru Elisei
2021-06-23 10:06 ` Andre Przywara
2021-06-23 10:12 ` Alexandru Elisei
2021-06-21 9:21 ` [PATCH v2 kvmtool 4/4] arm/arm64: vfio: Add PCI Express Capability Structure Alexandru Elisei
2021-06-21 14:04 ` Andre Przywara
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=20210621092128.11313-3-alexandru.elisei@arm.com \
--to=alexandru.elisei@arm.com \
--cc=andre.przywara@arm.com \
--cc=julien.thierry.kdev@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=maz@kernel.org \
--cc=pierre.gondois@arm.com \
--cc=sami.mujawar@arm.com \
--cc=will@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).