From: "Michael S. Tsirkin" <mst@redhat.com>
To: Isaku Yamahata <yamahata@valinux.co.jp>
Cc: qemu-devel@nongnu.org, Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] Re: [PATCH] pci hotplug: make pci hotplug return value to caller.
Date: Mon, 21 Jun 2010 14:40:06 +0300 [thread overview]
Message-ID: <20100621114006.GB10001@redhat.com> (raw)
In-Reply-To: <20100615034727.GT23473@valinux.co.jp>
On Tue, Jun 15, 2010 at 12:47:27PM +0900, Isaku Yamahata wrote:
> Make pci hotplug callback return value to caller.
> There is no reason to discard return value.
>
> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
> ---
> hw/pci.c | 11 +++++++----
> 1 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/hw/pci.c b/hw/pci.c
> index 7787005..3777c1c 100644
> --- a/hw/pci.c
> +++ b/hw/pci.c
> @@ -1623,8 +1623,12 @@ static int pci_qdev_init(DeviceState *qdev, DeviceInfo *base)
> pci_dev->romfile = qemu_strdup(info->romfile);
> pci_add_option_rom(pci_dev);
>
> - if (qdev->hotplugged)
> - bus->hotplug(bus->hotplug_qdev, pci_dev, 1);
> + if (qdev->hotplugged) {
> + rc = bus->hotplug(bus->hotplug_qdev, pci_dev, 1);
> + if (rc != 0) {
> + return rc;
I think we need to unregister the device (and remove option rom?),
otherwise there's a resource leak here.
Can it really fail? If not we can just make it void.
> + }
> + }
> return 0;
> }
>
> @@ -1632,8 +1636,7 @@ static int pci_unplug_device(DeviceState *qdev)
> {
> PCIDevice *dev = DO_UPCAST(PCIDevice, qdev, qdev);
>
> - dev->bus->hotplug(dev->bus->hotplug_qdev, dev, 0);
> - return 0;
> + return dev->bus->hotplug(dev->bus->hotplug_qdev, dev, 0);
> }
>
> void pci_qdev_register(PCIDeviceInfo *info)
> --
> 1.6.6.1
>
next prev parent reply other threads:[~2010-06-21 11:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-15 3:47 [Qemu-devel] [PATCH] pci hotplug: make pci hotplug return value to caller Isaku Yamahata
2010-06-15 8:55 ` [Qemu-devel] " Gerd Hoffmann
2010-06-21 9:53 ` [Qemu-devel] " Isaku Yamahata
2010-06-21 11:40 ` Michael S. Tsirkin [this message]
2010-06-21 12:31 ` [Qemu-devel] " Isaku Yamahata
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=20100621114006.GB10001@redhat.com \
--to=mst@redhat.com \
--cc=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=yamahata@valinux.co.jp \
/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.