All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Marcel Apfelbaum <marcel.a@redhat.com>
Cc: marcel@redhat.com, pbonzini@redhat.com,
	alex.williamson@redhat.com, qemu-devel@nongnu.org,
	mst@redhat.com
Subject: Re: [Qemu-devel] [PATCH v4 1/2] hw/pci: fixed error flow in pci_qdev_init
Date: Thu, 30 Oct 2014 14:33:11 +0100	[thread overview]
Message-ID: <87bnoty960.fsf@blackfin.pond.sub.org> (raw)
In-Reply-To: <1414431282-9839-2-git-send-email-marcel.a@redhat.com> (Marcel Apfelbaum's message of "Mon, 27 Oct 2014 19:34:41 +0200")

Marcel Apfelbaum <marcel.a@redhat.com> writes:

> Verify return code for pci_add_option_rom.
>
> Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
> ---
>  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 <armbru@redhat.com>

  reply	other threads:[~2014-10-31 15:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-27 17:34 [Qemu-devel] [PATCH v4 0/2] hw/pci: fixed hotplug crash when using rombar=0 with devices having romfile Marcel Apfelbaum
2014-10-27 17:34 ` [Qemu-devel] [PATCH v4 1/2] hw/pci: fixed error flow in pci_qdev_init Marcel Apfelbaum
2014-10-30 13:33   ` Markus Armbruster [this message]
2014-10-30 17:25     ` Marcel Apfelbaum
2014-10-27 17:34 ` [Qemu-devel] [PATCH v4 2/2] hw/pci: fixed hotplug crash when using rombar=0 with devices having romfile Marcel Apfelbaum
2014-11-03 12:03   ` Markus Armbruster
2014-11-03 12:46     ` Michael S. Tsirkin
2014-11-03 12:52     ` Marcel Apfelbaum
2014-11-03 13:40       ` Markus Armbruster
2014-11-03 13:49         ` Marcel Apfelbaum
2014-11-03 15:54           ` Markus Armbruster
2014-11-03 16:07             ` Marcel Apfelbaum
2014-11-03 16:10             ` Michael S. Tsirkin
2014-11-24 15:22 ` [Qemu-devel] [PATCH v4 0/2] " Marcel Apfelbaum

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=87bnoty960.fsf@blackfin.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=marcel.a@redhat.com \
    --cc=marcel@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@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.