diff mbox series

[v4,08/42] dm: core: Skip adding uclasses with OF_PLATDATA_INST

Message ID 20210315172537.v4.8.Icde748d3063580acf92b185f675701c077b72ba8@changeid
State Accepted
Commit 91bcfdf0b6683681c557db55e1d74424fb1cc4fe
Delegated to: Simon Glass
Headers show
Series dm: Implement OF_PLATDATA_INST in driver model (part E) | expand

Commit Message

Simon Glass March 15, 2021, 4:25 a.m. UTC
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(-)

Comments

Simon Glass March 17, 2021, 1:28 a.m. UTC | #1
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(-)

Applied to u-boot-dm/next, thanks!
diff mbox series

Patch

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;