qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vl: fix "type is NULL" in -vga help
@ 2024-07-15 11:44 marcandre.lureau
  2024-07-15 13:29 ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 4+ messages in thread
From: marcandre.lureau @ 2024-07-15 11:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: Marc-André Lureau, Paolo Bonzini

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Don't pass NULL to module_object_class_by_name(), when the interface is
unavailable.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 system/vl.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/system/vl.c b/system/vl.c
index bdd2f6ecf6..9e8f16f155 100644
--- a/system/vl.c
+++ b/system/vl.c
@@ -1000,9 +1000,16 @@ static bool vga_interface_available(VGAInterfaceType t)
     const VGAInterfaceInfo *ti = &vga_interfaces[t];
 
     assert(t < VGA_TYPE_MAX);
-    return !ti->class_names[0] ||
-           module_object_class_by_name(ti->class_names[0]) ||
-           module_object_class_by_name(ti->class_names[1]);
+
+    if (!ti->class_names[0] || module_object_class_by_name(ti->class_names[0])) {
+        return true;
+    }
+
+    if (ti->class_names[1] && module_object_class_by_name(ti->class_names[1])) {
+        return true;
+    }
+
+    return false;
 }
 
 static const char *
-- 
2.45.2.827.g557ae147e6



^ permalink raw reply related	[flat|nested] 4+ messages in thread
* [PATCH] vl: fix "type is NULL" in -vga help
@ 2024-05-15 11:25 marcandre.lureau
  0 siblings, 0 replies; 4+ messages in thread
From: marcandre.lureau @ 2024-05-15 11:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: Marc-André Lureau, Paolo Bonzini

From: Marc-André Lureau <marcandre.lureau@redhat.com>

A VGA interface is available if it has no class_names, or we can look up
any of the names - we shouldn't call module_object_class_by_name(NULL),
as happening for ex with TCX or CG3 on x86.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 system/vl.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/system/vl.c b/system/vl.c
index a3eede5fa5..398f88b0f0 100644
--- a/system/vl.c
+++ b/system/vl.c
@@ -999,9 +999,16 @@ static bool vga_interface_available(VGAInterfaceType t)
     const VGAInterfaceInfo *ti = &vga_interfaces[t];
 
     assert(t < VGA_TYPE_MAX);
-    return !ti->class_names[0] ||
-           module_object_class_by_name(ti->class_names[0]) ||
-           module_object_class_by_name(ti->class_names[1]);
+
+    if (!ti->class_names[0] || module_object_class_by_name(ti->class_names[0])) {
+        return true;
+    }
+
+    if (ti->class_names[1] && module_object_class_by_name(ti->class_names[1])) {
+        return true;
+    }
+
+    return false;
 }
 
 static const char *
-- 
2.41.0.28.gd7d8841f67



^ permalink raw reply related	[flat|nested] 4+ messages in thread
* [PATCH] vl: fix "type is NULL" in -vga help
@ 2024-04-15 11:15 marcandre.lureau
  0 siblings, 0 replies; 4+ messages in thread
From: marcandre.lureau @ 2024-04-15 11:15 UTC (permalink / raw)
  To: qemu-devel; +Cc: Marc-André Lureau, Paolo Bonzini

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Don't pass NULL to module_object_class_by_name().

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 system/vl.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/system/vl.c b/system/vl.c
index c644222982..23e1cb016f 100644
--- a/system/vl.c
+++ b/system/vl.c
@@ -992,9 +992,16 @@ static bool vga_interface_available(VGAInterfaceType t)
     const VGAInterfaceInfo *ti = &vga_interfaces[t];
 
     assert(t < VGA_TYPE_MAX);
-    return !ti->class_names[0] ||
-           module_object_class_by_name(ti->class_names[0]) ||
-           module_object_class_by_name(ti->class_names[1]);
+
+    if (!ti->class_names[0] || module_object_class_by_name(ti->class_names[0])) {
+        return true;
+    }
+
+    if (ti->class_names[1] && module_object_class_by_name(ti->class_names[1])) {
+        return true;
+    }
+
+    return false;
 }
 
 static const char *
-- 
2.41.0.28.gd7d8841f67



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-07-15 13:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-15 11:44 [PATCH] vl: fix "type is NULL" in -vga help marcandre.lureau
2024-07-15 13:29 ` Philippe Mathieu-Daudé
  -- strict thread matches above, loose matches on Subject: below --
2024-05-15 11:25 marcandre.lureau
2024-04-15 11:15 marcandre.lureau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).