From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark McLoughlin Subject: [PATCH 09/12] kvm: qemu: device-assignment: free device if hotplug fails Date: Fri, 28 Nov 2008 17:10:47 +0000 Message-ID: <1227892250-14386-9-git-send-email-markmc@redhat.com> References: <> <1227892250-14386-1-git-send-email-markmc@redhat.com> <1227892250-14386-2-git-send-email-markmc@redhat.com> <1227892250-14386-3-git-send-email-markmc@redhat.com> <1227892250-14386-4-git-send-email-markmc@redhat.com> <1227892250-14386-5-git-send-email-markmc@redhat.com> <1227892250-14386-6-git-send-email-markmc@redhat.com> <1227892250-14386-7-git-send-email-markmc@redhat.com> <1227892250-14386-8-git-send-email-markmc@redhat.com> Cc: kvm@vger.kernel.org, Mark McLoughlin To: Avi Kivity Return-path: Received: from mail01.svc.cra.dublin.eircom.net ([159.134.118.17]:35413 "HELO mail01.svc.cra.dublin.eircom.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1752132AbYK1RMI (ORCPT ); Fri, 28 Nov 2008 12:12:08 -0500 In-Reply-To: <1227892250-14386-8-git-send-email-markmc@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Signed-off-by: Mark McLoughlin --- qemu/hw/device-hotplug.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/qemu/hw/device-hotplug.c b/qemu/hw/device-hotplug.c index ba1b161..0bcac60 100644 --- a/qemu/hw/device-hotplug.c +++ b/qemu/hw/device-hotplug.c @@ -48,6 +48,11 @@ static PCIDevice *qemu_system_hot_assign_device(const char *opts, int bus_nr) } ret = init_assigned_device(adev, pci_bus); + if (ret == NULL) { + term_printf("Failed to assign device\n"); + free_assigned_device(adev); + return NULL; + } term_printf("Registered host PCI device %02x:%02x.%1x " "(\"%s\") as guest device %02x:%02x.%1x\n", -- 1.5.4.3