diff mbox series

[2/4] modules: check arch on qom lookup

Message ID 20210610101553.943689-3-kraxel@redhat.com
State New
Headers show
Series modules: add support for target-specific modules. | expand

Commit Message

Gerd Hoffmann June 10, 2021, 10:15 a.m. UTC
With target-specific modules we can have multiple modules implementing
the same object.  Therefore we have to check the target arch on lookup
to find the correct module.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 util/module.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/util/module.c b/util/module.c
index 860c257fc56e..35ba3f17cc5f 100644
--- a/util/module.c
+++ b/util/module.c
@@ -380,6 +380,9 @@  void module_load_qom_one(const char *type)
         if (!modlist->value->has_objs) {
             continue;
         }
+        if (!module_check_arch(modlist->value)) {
+            continue;
+        }
         for (sl = modlist->value->objs; sl != NULL; sl = sl->next) {
             if (strcmp(type, sl->value) == 0) {
                 module_load_one("", modlist->value->name, false);
@@ -403,6 +406,9 @@  void module_load_qom_all(void)
         if (!modlist->value->has_objs) {
             continue;
         }
+        if (!module_check_arch(modlist->value)) {
+            continue;
+        }
         module_load_one("", modlist->value->name, false);
     }
     module_loaded_qom_all = true;