From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Andreas Färber" <afaerber@suse.de>
Cc: Igor Mammedov <imammedo@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] qdev: Fix bus dependency of DeviceState::hotpluggable getter
Date: Sun, 9 Mar 2014 18:40:18 +0200 [thread overview]
Message-ID: <20140309164018.GB8717@redhat.com> (raw)
In-Reply-To: <1394215998-10830-1-git-send-email-afaerber@suse.de>
On Fri, Mar 07, 2014 at 07:13:18PM +0100, Andreas Färber wrote:
> Commit 1a37eca107cece3ed454bae29eef0bd1fac4a244 (qdev: add
> "hotpluggable" property to Device) added a property "hotpluggable" to
> each device, with its getter accessing parent_bus->allow_hotplug.
>
> Add a NULL check.
>
> Cc: Igor Mammedov <imammedo@redhat.com>
> Signed-off-by: Andreas Färber <afaerber@suse.de>
Fair enough but I'm guessing we should
assume devices without a parent are not
hotpluggable, should we not?
Without a bus what handles hotplug?
> ---
> hw/core/qdev.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
> index 749c83a..cb07863 100644
> --- a/hw/core/qdev.c
> +++ b/hw/core/qdev.c
> @@ -735,7 +735,8 @@ static bool device_get_hotpluggable(Object *obj, Error **err)
> DeviceClass *dc = DEVICE_GET_CLASS(obj);
> DeviceState *dev = DEVICE(obj);
>
> - return dc->hotpluggable && dev->parent_bus->allow_hotplug;
> + return dc->hotpluggable && (dev->parent_bus == NULL ||
> + dev->parent_bus->allow_hotplug);
So maybe this should be:
> return dc->hotpluggable && dev->parent_bus &&
> dev->parent_bus->allow_hotplug;
?
> }
>
> static void device_initfn(Object *obj)
> --
> 1.8.4.5
next prev parent reply other threads:[~2014-03-09 16:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-07 18:13 [Qemu-devel] [PATCH] qdev: Fix bus dependency of DeviceState::hotpluggable getter Andreas Färber
2014-03-09 16:40 ` Michael S. Tsirkin [this message]
2014-03-09 16:48 ` Andreas Färber
2014-03-09 16:55 ` Michael S. Tsirkin
2014-03-10 11:37 ` Igor Mammedov
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=20140309164018.GB8717@redhat.com \
--to=mst@redhat.com \
--cc=afaerber@suse.de \
--cc=imammedo@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.