qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 0/1] usb-serial: Remove double call to qemu_chr_add_handlers( NULL )
Date: Sun, 24 Mar 2013 13:48:26 +0100	[thread overview]
Message-ID: <1364129307-12873-1-git-send-email-hdegoede@redhat.com> (raw)

usb-serial has a qdev chardev property, and hw/qdev-properties-system.c
already contains:

static void release_chr(Object *obj, const char *name, void *opaque)
{
    DeviceState *dev = DEVICE(obj);
    Property *prop = opaque;
    CharDriverState **ptr = qdev_get_prop_ptr(dev, prop);

    if (*ptr) {
        qemu_chr_add_handlers(*ptr, NULL, NULL, NULL, NULL);
    }
}

So doing the qemu_chr_add_handlers(s->cs, NULL, NULL, NULL, NULL); from
the usb handle_destroy function too will lead to it being done twice, which
will result in a wrong value for cs->avail_connections.

Note:
1) I noticed this will working on other stuff, but I've not actually seen this
happening (I did not try to trigger it), so please review carefully.

2) There are other places which are doing a qemu_chr_add_handlers( NULL )
too, but those don't use a qdev chardev property, so this does not apply:

backends/rng-egd.c
hw/serial.c
hw/xen_console.c

backends/rng-egd.c is weird / suspect here since it uses a qdev string
property for the chardev and then uses qemu_chr_find to get it. I wonder
why it is not simply using a chardev property rather then a string property?

Regards,

Hans

             reply	other threads:[~2013-03-24 12:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-24 12:48 Hans de Goede [this message]
2013-03-24 12:48 ` [Qemu-devel] [PATCH] usb-serial: Remove double call to qemu_chr_add_handlers( NULL ) Hans de Goede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1364129307-12873-1-git-send-email-hdegoede@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).