qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Mao Zhongyi <maozy.fnst@cn.fujitsu.com>
Cc: qemu-devel@nongnu.org, marcel@redhat.com, armbru@redhat.com,
	mst@redhat.com
Subject: Re: [Qemu-devel] [PATCH] pci: Set err to errp directly rather than through error_porpagate()
Date: Fri, 26 May 2017 11:43:20 +0200	[thread overview]
Message-ID: <20170526114320.63f4f0b3@nial.brq.redhat.com> (raw)
In-Reply-To: <20170526082925.2888-1-maozy.fnst@cn.fujitsu.com>

On Fri, 26 May 2017 16:29:25 +0800
Mao Zhongyi <maozy.fnst@cn.fujitsu.com> wrote:

> ioh3420_interrupts_init() and its callers, rp_realize() and
> pci_qdev_realize() fill error message to local_err, then
> propagate it to errp by error_porpagate(), which's not necessary.
> So eliminate it and pass errp directly instead of local_err.
> Of course, error_propagate() also will be removed.
> 
> Signed-off-by: Mao Zhongyi <maozy.fnst@cn.fujitsu.com>
> ---
[...]

> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
> index 98ccc27..0d4a3ff 100644
> --- a/hw/pci/pci.c
> +++ b/hw/pci/pci.c
> @@ -1982,7 +1982,6 @@ static void pci_qdev_realize(DeviceState *qdev, Error **errp)
>  {
>      PCIDevice *pci_dev = (PCIDevice *)qdev;
>      PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(pci_dev);
> -    Error *local_err = NULL;
>      PCIBus *bus;
>      bool is_default_rom;
>  
> @@ -1999,9 +1998,8 @@ static void pci_qdev_realize(DeviceState *qdev, Error **errp)
>          return;
>  
>      if (pc->realize) {
> -        pc->realize(pci_dev, &local_err);
> -        if (local_err) {
> -            error_propagate(errp, local_err);
> +        pc->realize(pci_dev, errp);
> +        if (errp && *errp) {
>              do_pci_unregister_device(pci_dev);
>              return;
>          }
> @@ -2014,9 +2012,8 @@ static void pci_qdev_realize(DeviceState *qdev, Error **errp)
>          is_default_rom = true;
>      }
>  
> -    pci_add_option_rom(pci_dev, is_default_rom, &local_err);
> -    if (local_err) {
> -        error_propagate(errp, local_err);
> +    pci_add_option_rom(pci_dev, is_default_rom, errp);
> +    if (errp && *errp) {
>          pci_qdev_unrealize(DEVICE(pci_dev), NULL);
>          return;
>      }

dropping local_error here looks wrong since it's used
to check error status inside these functions and to undo
side effects in case of failure.

consider if caller pass errp = NULL
then error handling path won't be executed.

So keep the rest of the patch but drop above hunks. 

  reply	other threads:[~2017-05-26  9:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-26  8:29 [Qemu-devel] [PATCH] pci: Set err to errp directly rather than through error_porpagate() Mao Zhongyi
2017-05-26  9:43 ` Igor Mammedov [this message]
2017-05-26 11:08   ` Mao Zhongyi
2017-05-29  7:51   ` Markus Armbruster
2017-05-31  1:38     ` Mao Zhongyi

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=20170526114320.63f4f0b3@nial.brq.redhat.com \
    --to=imammedo@redhat.com \
    --cc=armbru@redhat.com \
    --cc=maozy.fnst@cn.fujitsu.com \
    --cc=marcel@redhat.com \
    --cc=mst@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).