* [Qemu-devel] [PATCH v2] pci: Set err to errp directly rather than through error_porpagate()
@ 2017-05-26 11:58 Mao Zhongyi
2017-05-26 13:33 ` Eric Blake
2017-05-26 13:54 ` Marcel Apfelbaum
0 siblings, 2 replies; 4+ messages in thread
From: Mao Zhongyi @ 2017-05-26 11:58 UTC (permalink / raw)
To: qemu-devel; +Cc: mst, marcel, imammedo, armbru
ioh3420_interrupts_init() and its callers rp_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 has been removed.
Signed-off-by: Mao Zhongyi <maozy.fnst@cn.fujitsu.com>
---
v2:
* Drop the part of wrong handling that ignored the fact that if
pci_qdev_realize()'s caller pass errp = NULL.
hw/pci-bridge/ioh3420.c | 4 +---
hw/pci-bridge/pcie_root_port.c | 7 ++-----
2 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/hw/pci-bridge/ioh3420.c b/hw/pci-bridge/ioh3420.c
index da4e5bd..5f56a2f 100644
--- a/hw/pci-bridge/ioh3420.c
+++ b/hw/pci-bridge/ioh3420.c
@@ -64,15 +64,13 @@ static uint8_t ioh3420_aer_vector(const PCIDevice *d)
static int ioh3420_interrupts_init(PCIDevice *d, Error **errp)
{
int rc;
- Error *local_err = NULL;
rc = msi_init(d, IOH_EP_MSI_OFFSET, IOH_EP_MSI_NR_VECTOR,
IOH_EP_MSI_SUPPORTED_FLAGS & PCI_MSI_FLAGS_64BIT,
IOH_EP_MSI_SUPPORTED_FLAGS & PCI_MSI_FLAGS_MASKBIT,
- &local_err);
+ errp);
if (rc < 0) {
assert(rc == -ENOTSUP);
- error_propagate(errp, local_err);
}
return rc;
diff --git a/hw/pci-bridge/pcie_root_port.c b/hw/pci-bridge/pcie_root_port.c
index cf36318..9022996 100644
--- a/hw/pci-bridge/pcie_root_port.c
+++ b/hw/pci-bridge/pcie_root_port.c
@@ -59,7 +59,6 @@ static void rp_realize(PCIDevice *d, Error **errp)
PCIDeviceClass *dc = PCI_DEVICE_GET_CLASS(d);
PCIERootPortClass *rpc = PCIE_ROOT_PORT_GET_CLASS(d);
int rc;
- Error *local_err = NULL;
pci_config_set_interrupt_pin(d->config, 1);
pci_bridge_initfn(d, TYPE_PCIE_BUS);
@@ -72,9 +71,8 @@ static void rp_realize(PCIDevice *d, Error **errp)
}
if (rpc->interrupts_init) {
- rc = rpc->interrupts_init(d, &local_err);
+ rc = rpc->interrupts_init(d, errp);
if (rc < 0) {
- error_propagate(errp, local_err);
goto err_bridge;
}
}
@@ -98,9 +96,8 @@ static void rp_realize(PCIDevice *d, Error **errp)
}
rc = pcie_aer_init(d, PCI_ERR_VER, rpc->aer_offset,
- PCI_ERR_SIZEOF, &local_err);
+ PCI_ERR_SIZEOF, errp);
if (rc < 0) {
- error_propagate(errp, local_err);
goto err;
}
pcie_aer_root_init(d);
--
2.9.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH v2] pci: Set err to errp directly rather than through error_porpagate()
2017-05-26 11:58 [Qemu-devel] [PATCH v2] pci: Set err to errp directly rather than through error_porpagate() Mao Zhongyi
@ 2017-05-26 13:33 ` Eric Blake
2017-05-27 5:17 ` Mao Zhongyi
2017-05-26 13:54 ` Marcel Apfelbaum
1 sibling, 1 reply; 4+ messages in thread
From: Eric Blake @ 2017-05-26 13:33 UTC (permalink / raw)
To: Mao Zhongyi, qemu-devel; +Cc: marcel, imammedo, armbru, mst
[-- Attachment #1: Type: text/plain, Size: 964 bytes --]
On 05/26/2017 06:58 AM, Mao Zhongyi wrote:
In the subject: s/porpagate/propagate/
> ioh3420_interrupts_init() and its callers rp_realize() fill error
> message to local_err, then propagate it to errp by error_porpagate(),
and again
> which's not necessary. So eliminate it and pass errp directly instead
s/which's/which is/ (English does not have the abbreviation which's)
> of local_err. Of course, error_propagate() also has been removed.
>
> Signed-off-by: Mao Zhongyi <maozy.fnst@cn.fujitsu.com>
> ---
> v2:
> * Drop the part of wrong handling that ignored the fact that if
> pci_qdev_realize()'s caller pass errp = NULL.
>
The code portion is fine, so with the commit message fixed (which a
maintainer might do without needing you to send a v3),
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH v2] pci: Set err to errp directly rather than through error_porpagate()
2017-05-26 13:33 ` Eric Blake
@ 2017-05-27 5:17 ` Mao Zhongyi
0 siblings, 0 replies; 4+ messages in thread
From: Mao Zhongyi @ 2017-05-27 5:17 UTC (permalink / raw)
To: Eric Blake, qemu-devel; +Cc: marcel, imammedo, armbru, mst
On 05/26/2017 09:33 PM, Eric Blake wrote:
> On 05/26/2017 06:58 AM, Mao Zhongyi wrote:
>
> In the subject: s/porpagate/propagate/
>
>> ioh3420_interrupts_init() and its callers rp_realize() fill error
>> message to local_err, then propagate it to errp by error_porpagate(),
>
> and again
OK, I see.
Thanks
>
>> which's not necessary. So eliminate it and pass errp directly instead
>
> s/which's/which is/ (English does not have the abbreviation which's)
Thanks for your kindly remind. I think that this problem will not
happen again. :)
>
>> of local_err. Of course, error_propagate() also has been removed.
>>
>> Signed-off-by: Mao Zhongyi <maozy.fnst@cn.fujitsu.com>
>> ---
>> v2:
>> * Drop the part of wrong handling that ignored the fact that if
>> pci_qdev_realize()'s caller pass errp = NULL.
>>
>
> The code portion is fine, so with the commit message fixed (which a
> maintainer might do without needing you to send a v3),
> Reviewed-by: Eric Blake <eblake@redhat.com>
>
I am very glad to hear that.
I will fix it again in the v3. After all, it's not good to bother
others.
Thanks a lot.
Mao
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH v2] pci: Set err to errp directly rather than through error_porpagate()
2017-05-26 11:58 [Qemu-devel] [PATCH v2] pci: Set err to errp directly rather than through error_porpagate() Mao Zhongyi
2017-05-26 13:33 ` Eric Blake
@ 2017-05-26 13:54 ` Marcel Apfelbaum
1 sibling, 0 replies; 4+ messages in thread
From: Marcel Apfelbaum @ 2017-05-26 13:54 UTC (permalink / raw)
To: Mao Zhongyi, qemu-devel; +Cc: mst, imammedo, armbru
On 26/05/2017 14:58, Mao Zhongyi wrote:
> ioh3420_interrupts_init() and its callers rp_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 has been removed.
>
> Signed-off-by: Mao Zhongyi <maozy.fnst@cn.fujitsu.com>
> ---
> v2:
> * Drop the part of wrong handling that ignored the fact that if
> pci_qdev_realize()'s caller pass errp = NULL.
>
> hw/pci-bridge/ioh3420.c | 4 +---
> hw/pci-bridge/pcie_root_port.c | 7 ++-----
> 2 files changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/hw/pci-bridge/ioh3420.c b/hw/pci-bridge/ioh3420.c
> index da4e5bd..5f56a2f 100644
> --- a/hw/pci-bridge/ioh3420.c
> +++ b/hw/pci-bridge/ioh3420.c
> @@ -64,15 +64,13 @@ static uint8_t ioh3420_aer_vector(const PCIDevice *d)
> static int ioh3420_interrupts_init(PCIDevice *d, Error **errp)
> {
> int rc;
> - Error *local_err = NULL;
>
> rc = msi_init(d, IOH_EP_MSI_OFFSET, IOH_EP_MSI_NR_VECTOR,
> IOH_EP_MSI_SUPPORTED_FLAGS & PCI_MSI_FLAGS_64BIT,
> IOH_EP_MSI_SUPPORTED_FLAGS & PCI_MSI_FLAGS_MASKBIT,
> - &local_err);
> + errp);
> if (rc < 0) {
> assert(rc == -ENOTSUP);
> - error_propagate(errp, local_err);
> }
>
> return rc;
> diff --git a/hw/pci-bridge/pcie_root_port.c b/hw/pci-bridge/pcie_root_port.c
> index cf36318..9022996 100644
> --- a/hw/pci-bridge/pcie_root_port.c
> +++ b/hw/pci-bridge/pcie_root_port.c
> @@ -59,7 +59,6 @@ static void rp_realize(PCIDevice *d, Error **errp)
> PCIDeviceClass *dc = PCI_DEVICE_GET_CLASS(d);
> PCIERootPortClass *rpc = PCIE_ROOT_PORT_GET_CLASS(d);
> int rc;
> - Error *local_err = NULL;
>
> pci_config_set_interrupt_pin(d->config, 1);
> pci_bridge_initfn(d, TYPE_PCIE_BUS);
> @@ -72,9 +71,8 @@ static void rp_realize(PCIDevice *d, Error **errp)
> }
>
> if (rpc->interrupts_init) {
> - rc = rpc->interrupts_init(d, &local_err);
> + rc = rpc->interrupts_init(d, errp);
> if (rc < 0) {
> - error_propagate(errp, local_err);
> goto err_bridge;
> }
> }
> @@ -98,9 +96,8 @@ static void rp_realize(PCIDevice *d, Error **errp)
> }
>
> rc = pcie_aer_init(d, PCI_ERR_VER, rpc->aer_offset,
> - PCI_ERR_SIZEOF, &local_err);
> + PCI_ERR_SIZEOF, errp);
> if (rc < 0) {
> - error_propagate(errp, local_err);
> goto err;
> }
> pcie_aer_root_init(d);
Reviewed-by: Marcel Apfelbaum<marcel@redhat.com>
Thanks,
Marcel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-05-27 5:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-26 11:58 [Qemu-devel] [PATCH v2] pci: Set err to errp directly rather than through error_porpagate() Mao Zhongyi
2017-05-26 13:33 ` Eric Blake
2017-05-27 5:17 ` Mao Zhongyi
2017-05-26 13:54 ` Marcel Apfelbaum
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).