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.