From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37992) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XkEGD-0005aG-HC for qemu-devel@nongnu.org; Fri, 31 Oct 2014 11:38:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XjtUY-0001MB-Py for qemu-devel@nongnu.org; Thu, 30 Oct 2014 13:26:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41648) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XjtUY-0001LV-I9 for qemu-devel@nongnu.org; Thu, 30 Oct 2014 13:26:34 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s9UHQWtS028947 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Thu, 30 Oct 2014 13:26:33 -0400 Message-ID: <1414689940.2327.12.camel@localhost.localdomain> From: Marcel Apfelbaum Date: Thu, 30 Oct 2014 19:25:40 +0200 In-Reply-To: <87bnoty960.fsf@blackfin.pond.sub.org> References: <1414431282-9839-1-git-send-email-marcel.a@redhat.com> <1414431282-9839-2-git-send-email-marcel.a@redhat.com> <87bnoty960.fsf@blackfin.pond.sub.org> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v4 1/2] hw/pci: fixed error flow in pci_qdev_init List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: mst@redhat.com Cc: marcel@redhat.com, pbonzini@redhat.com, alex.williamson@redhat.com, qemu-devel@nongnu.org, Markus Armbruster On Thu, 2014-10-30 at 14:33 +0100, Markus Armbruster wrote: > Marcel Apfelbaum writes: > > > Verify return code for pci_add_option_rom. > > > > Signed-off-by: Marcel Apfelbaum > > --- > > hw/pci/pci.c | 7 ++++++- > > 1 file changed, 6 insertions(+), 1 deletion(-) > > > > diff --git a/hw/pci/pci.c b/hw/pci/pci.c > > index 6ce75aa..36226eb 100644 > > --- a/hw/pci/pci.c > > +++ b/hw/pci/pci.c > > @@ -1776,7 +1776,12 @@ static int pci_qdev_init(DeviceState *qdev) > > pci_dev->romfile = g_strdup(pc->romfile); > > is_default_rom = true; > > } > > - pci_add_option_rom(pci_dev, is_default_rom); > > + > > + rc = pci_add_option_rom(pci_dev, is_default_rom); > > + if (rc != 0) { > > + pci_unregister_device(DEVICE(pci_dev)); > > + return rc; > > + } > > > > return 0; > > } > > Safe, because pci_add_option_rom() sets pci_dev->has_rom only on > success, and pci_unregister_device() cleans up the ROM only when > pci_has_rom is set. > > Reviewed-by: Markus Armbruster Hi Michael, The series has been reviewed, can you please add it to your next pull request? Thanks, Marcel