qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/7] serial: add serial_chr_nonnull() to use the


From: Philippe Mathieu-Daudé
Subject: Re: [Qemu-devel] [PATCH 1/7] serial: add serial_chr_nonnull() to use the null backend when none provided
Date: Thu, 31 Aug 2017 12:20:53 -0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0

On 08/31/2017 02:19 AM, Thomas Huth wrote:
On 31.08.2017 05:53, Philippe Mathieu-Daudé wrote:
[...]>> +Chardev *serial_chr_nonnull(Chardev *chr)
+{
+    static int serial_id;
+    char *label;
+
+    label = g_strdup_printf("discarding-serial%d", serial_id++);
+    chr = qemu_chr_new(label, "null");

That looks wrong - you're ignoring the input parameter and always open
the "null" device? Shouldn't there be a "if (chr) return chr;" in front
of this?

You right. I had this correct in my first patch when this code was embedded, I then failed at extracting as another function :/


+    assert(chr);
+    g_free(label);
+
+    return chr;
+}

  Thomas

PS: I think you should also merge the two patches together, they are
small enough.

Ok.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]