From 45224e8f26913bbd70960f316401134f3c366d78 Mon Sep 17 00:00:00 2001 From: Marcel Ziswiler Date: Mon, 20 May 2019 02:44:57 +0200 Subject: [PATCH] dm: core: gracefully handle alias seq without of Gracefully handle alias seq in the platform data rather than OF case. Signed-off-by: Marcel Ziswiler --- 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 047089c886..85b3b7a5ad 100644 --- a/drivers/core/read.c +++ b/drivers/core/read.c @@ -275,15 +275,17 @@ int dev_read_alias_seq(const 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 1c1bc3702f..3711386f51 100644 --- a/include/dm/read.h +++ b/include/dm/read.h @@ -923,8 +923,12 @@ static inline const void *dev_read_prop_by_prop(struct ofprop *prop, static inline int dev_read_alias_seq(const 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(const struct udevice *dev, -- 2.39.5