
15 Mar
2021
15 Mar
'21
5:25 a.m.
There is no need to ever add new uclasses since these are set up at build time. Update the code to return an error if this is attempted.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
drivers/core/uclass.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c index 1a4ea7a57a6..f753a1f91e7 100644 --- a/drivers/core/uclass.c +++ b/drivers/core/uclass.c @@ -148,8 +148,11 @@ int uclass_get(enum uclass_id id, struct uclass **ucp)
*ucp = NULL; uc = uclass_find(id); - if (!uc) + if (!uc) { + if (CONFIG_IS_ENABLED(OF_PLATDATA_INST)) + return -ENOENT; return uclass_add(id, ucp); + } *ucp = uc;
return 0;
--
2.31.0.rc2.261.g7f71774620-goog