]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
dm: test: Avoid destroying uclasses with of-platdata-inst
authorSimon Glass <sjg@chromium.org>
Mon, 15 Mar 2021 04:25:21 +0000 (17:25 +1300)
committerSimon Glass <sjg@chromium.org>
Fri, 26 Mar 2021 04:03:08 +0000 (17:03 +1300)
It is not possible to destroy the uclasses when they are created at
build time. Skip this step so that SPL test can complete successfully.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
test/test-main.c

index e1b49e091ab662f97105240f7287a95a2dd7bef2..46a0c2ee2f6e9559453ccdd927d9cf6f2de958f1 100644 (file)
@@ -62,17 +62,25 @@ static int dm_test_post_run(struct unit_test_state *uts)
 {
        int id;
 
-       for (id = 0; id < UCLASS_COUNT; id++) {
-               struct uclass *uc;
-
-               /*
-                * If the uclass doesn't exist we don't want to create it. So
-                * check that here before we call uclass_find_device().
-                */
-               uc = uclass_find(id);
-               if (!uc)
-                       continue;
-               ut_assertok(uclass_destroy(uc));
+       /*
+        * With of-platdata-inst the uclasses are created at build time. If we
+        * destroy them we cannot get them back since uclass_add() is not
+        * supported. So skip this.
+        */
+       if (!CONFIG_IS_ENABLED(OF_PLATDATA_INST)) {
+               for (id = 0; id < UCLASS_COUNT; id++) {
+                       struct uclass *uc;
+
+                       /*
+                        * If the uclass doesn't exist we don't want to create
+                        * it. So check that here before we call
+                        * uclass_find_device().
+                        */
+                       uc = uclass_find(id);
+                       if (!uc)
+                               continue;
+                       ut_assertok(uclass_destroy(uc));
+               }
        }
 
        return 0;