[U-Boot] [PATCH v1 05/10] dm: core: gracefully handle alias seq without of

Marcel Ziswiler marcel at ziswiler.com
Mon May 20 00:44:57 UTC 2019


Gracefully handle alias seq in the platform data rather than OF case.

Signed-off-by: Marcel Ziswiler <marcel at ziswiler.com>

---

 drivers/core/read.c | 4 +++-
 include/dm/read.h   | 4 ++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/core/read.c b/drivers/core/read.c
index 6bda077a34..670ffe5dc5 100644
--- a/drivers/core/read.c
+++ b/drivers/core/read.c
@@ -212,15 +212,17 @@ int dev_read_alias_seq(struct udevice *dev, int *devnump)
 {
 	ofnode node = dev_ofnode(dev);
 	const char *uc_name = dev->uclass->uc_drv->name;
-	int ret;
+	int ret = -ENOTSUPP;
 
 	if (ofnode_is_np(node)) {
 		ret = of_alias_get_id(ofnode_to_np(node), uc_name);
 		if (ret >= 0)
 			*devnump = ret;
 	} else {
+#if CONFIG_IS_ENABLED(OF_CONTROL)
 		ret = fdtdec_get_alias_seq(gd->fdt_blob, uc_name,
 					   ofnode_to_offset(node), devnump);
+#endif
 	}
 
 	return ret;
diff --git a/include/dm/read.h b/include/dm/read.h
index 60b727cbd8..a8ffbe42ac 100644
--- a/include/dm/read.h
+++ b/include/dm/read.h
@@ -702,8 +702,12 @@ static inline const void *dev_read_prop(struct udevice *dev,
 
 static inline int dev_read_alias_seq(struct udevice *dev, int *devnump)
 {
+#if CONFIG_IS_ENABLED(OF_CONTROL)
 	return fdtdec_get_alias_seq(gd->fdt_blob, dev->uclass->uc_drv->name,
 				    dev_of_offset(dev), devnump);
+#else
+	return -ENOTSUPP;
+#endif
 }
 
 static inline int dev_read_u32_array(struct udevice *dev, const char *propname,
-- 
2.21.0



More information about the U-Boot mailing list