summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeng Fan <[email protected]>2026-02-10 16:12:16 +0800
committerTom Rini <[email protected]>2026-02-26 09:04:46 -0600
commitefc9be77d851b98b38afcfb4e46d17703057efad (patch)
tree1e60d2c76c421bee801b39a826ecf4bce15005a6
parent6ee82240de63b085325b4f4ce4874240724f9dbe (diff)
iommu: Validate device tree node in dev_iommu_enable
Similar to pinctrl_select_state(), add dev_has_ofnode() check before doing the real work. Device(scmi_base.0) does not have a real device node, ofnode_null() is assigned as the device tree node for scmi base protocol device: 'commit 7eb4eb541c14 ("firmware: scmi: install base protocol to SCMI agent")' However with recent update in 'commit 0535e46d55d7 ("scripts/dtc: Update to upstream version v1.7.2-35-g52f07dcca47c")', SPL panic in fdt_check_node_offset_()->fdt_next_tag(), because offset is -1 and SPL_OF_LIBFDT_ASSUME_MASK is 0xFF. So need to validate device tree node. Reported-by: Ye Li <[email protected]> Closes: https://lore.kernel.org/u-boot/[email protected]/ Signed-off-by: Peng Fan <[email protected]>
-rw-r--r--drivers/iommu/iommu-uclass.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/iommu/iommu-uclass.c b/drivers/iommu/iommu-uclass.c
index bb31cd519d2..31b40e5713a 100644
--- a/drivers/iommu/iommu-uclass.c
+++ b/drivers/iommu/iommu-uclass.c
@@ -79,6 +79,9 @@ int dev_iommu_enable(struct udevice *dev)
const struct iommu_ops *ops;
int i, count, ret = 0;
+ if (!dev_has_ofnode(dev))
+ return 0;
+
count = dev_count_phandle_with_args(dev, "iommus",
"#iommu-cells", 0);
for (i = 0; i < count; i++) {