From: Ahmad Fatoum <a.fatoum@barebox.org>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@barebox.org>
Subject: [PATCH v3 06/10] mci: do not look up OF partitions for DT-less host controllers
Date: Mon, 29 Jun 2026 14:45:25 +0200 [thread overview]
Message-ID: <20260629124631.689090-6-a.fatoum@barebox.org> (raw)
In-Reply-To: <20260629124631.689090-1-a.fatoum@barebox.org>
When mci_card_probe is called on a device that has been registered
without a device tree node, mci_get_partitions_node will end up with
a NULL pointer dereference inside of_get_child_by_name().
Other MCI code already handles this gracefully, so guard this code with
a NULL check as well.
While at it, rename the function to be more similar to existing
convention: Functions processing and manipulting the DT start with of_
instead of a trailing _node in their name.
Fixes: 6e9a87b39429 ("mci: Allow to partition eMMC boot partitions")
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
v2 -> v3:
- split off NULL check into its own commit (Sascha)
- renamed the function
---
drivers/mci/mci-core.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 4413fd1655aa..874ee40cb3b4 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -2935,14 +2935,14 @@ static const char *mci_boot_names[] = {
"user",
};
-static struct device_node *mci_get_partition_node(struct device_node *hwnode,
- unsigned int type,
- unsigned int index)
+static struct device_node *of_mci_get_partition(struct device_node *hwnode,
+ unsigned int type,
+ unsigned int index)
{
struct device_node *np;
char partnodename[sizeof("bootx-partitions")];
- if (index > 8)
+ if (!hwnode || index > 8)
return NULL;
switch (type) {
@@ -3004,7 +3004,7 @@ static int mci_register_partition(struct mci_part *part)
}
dev_info(&mci->dev, "registered %s\n", part->blk.cdev.name);
- np = mci_get_partition_node(host->hw_dev->of_node, part->area_type, part->idx);
+ np = of_mci_get_partition(host->hw_dev->of_node, part->area_type, part->idx);
if (np) {
of_parse_partitions(&part->blk.cdev, np);
--
2.47.3
next prev parent reply other threads:[~2026-06-29 12:47 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-29 12:45 [PATCH v3 01/10] scripts: duplicate conftest.py as qemu_interactive.py Ahmad Fatoum
2026-06-29 12:45 ` [PATCH v3 02/10] test: move interactive QEMU launcher out of pytest Ahmad Fatoum
2026-06-29 12:45 ` [PATCH v3 03/10] usb: xhci-hcd: add XHCI over PCI driver Ahmad Fatoum
2026-06-29 12:45 ` [PATCH v3 04/10] scripts: qemu_interactive.py: add new --usbblk option Ahmad Fatoum
2026-06-29 12:45 ` [PATCH v3 05/10] scripts: qemu_interactive.py: add new --nvmeblk option Ahmad Fatoum
2026-06-29 12:45 ` Ahmad Fatoum [this message]
2026-06-29 12:45 ` [PATCH v3 07/10] mci: sdhci: define same SDHCI_INT_* constants as Linux Ahmad Fatoum
2026-06-29 12:45 ` [PATCH v3 08/10] mci: add PCI SDHCI controller support Ahmad Fatoum
2026-06-29 12:45 ` [PATCH v3 09/10] ARM: multi_v8_defconfig: enable OP-TEE and RPMB support Ahmad Fatoum
2026-06-29 12:45 ` [PATCH v3 10/10] scripts: qemu_interactive.py: add new --sdblk and --emmcblk options Ahmad Fatoum
2026-07-02 6:58 ` [PATCH v3 01/10] scripts: duplicate conftest.py as qemu_interactive.py Sascha Hauer
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=20260629124631.689090-6-a.fatoum@barebox.org \
--to=a.fatoum@barebox.org \
--cc=barebox@lists.infradead.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