qemu-e2k/hw/ppc
Markus Armbruster dcfe480544 error: Avoid unnecessary error_propagate() after error_setg()
Replace

    error_setg(&err, ...);
    error_propagate(errp, err);

by

    error_setg(errp, ...);

Related pattern:

    if (...) {
        error_setg(&err, ...);
        goto out;
    }
    ...
 out:
    error_propagate(errp, err);
    return;

When all paths to label out are that way, replace by

    if (...) {
        error_setg(errp, ...);
        return;
    }

and delete the label along with the error_propagate().

When we have at most one other path that actually needs to propagate,
and maybe one at the end that where propagation is unnecessary, e.g.

    foo(..., &err);
    if (err) {
        goto out;
    }
    ...
    bar(..., &err);
 out:
    error_propagate(errp, err);
    return;

move the error_propagate() to where it's needed, like

    if (...) {
        foo(..., &err);
        error_propagate(errp, err);
        return;
    }
    ...
    bar(..., errp);
    return;

and transform the error_setg() as above.

In some places, the transformation results in obviously unnecessary
error_propagate().  The next few commits will eliminate them.

Bonus: the elimination of gotos will make later patches in this series
easier to review.

Candidates for conversion tracked down with this Coccinelle script:

    @@
    identifier err, errp;
    expression list args;
    @@
    -    error_setg(&err, args);
    +    error_setg(errp, args);
         ... when != err
         error_propagate(errp, err);

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200707160613.848843-34-armbru@redhat.com>
2020-07-10 15:18:08 +02:00
..
e500-ccsr.h
e500.c qdev: Use returned bool to check for qdev_realize() etc. failure 2020-07-10 15:01:06 +02:00
e500.h
e500plat.c
fdt.c
fw_cfg.c
Kconfig ppc/pnv: Fix PCI_EXPRESS dependency 2020-02-21 09:15:03 +11:00
mac_newworld.c qom: Put name parameter before value / visitor parameter 2020-07-10 15:18:08 +02:00
mac_oldworld.c qom: Put name parameter before value / visitor parameter 2020-07-10 15:18:08 +02:00
mac.h
Makefile.objs spapr: Add NVDIMM device support 2020-02-21 09:15:04 +11:00
mpc8544_guts.c
mpc8544ds.c
pnv_bmc.c qdev: Convert bus-less devices to qdev_realize() with Coccinelle 2020-06-15 22:06:04 +02:00
pnv_core.c qdev: Use returned bool to check for qdev_realize() etc. failure 2020-07-10 15:01:06 +02:00
pnv_homer.c
pnv_lpc.c hw/ppc/pnv: Fix typo in comment 2020-03-17 09:41:14 +11:00
pnv_occ.c
pnv_pnor.c
pnv_psi.c qom: Use returned bool to check for failure, Coccinelle part 2020-07-10 15:18:08 +02:00
pnv_xscom.c
pnv.c qom: Put name parameter before value / visitor parameter 2020-07-10 15:18:08 +02:00
ppc4xx_devs.c bamboo, sam460ex: Tidy up error message for unsupported RAM size 2020-04-29 08:01:52 +02:00
ppc4xx_pci.c
ppc405_boards.c ppc/ppc405_boards: Remove unnecessary NULL check 2020-03-24 11:56:37 +11:00
ppc405_uc.c
ppc405.h
ppc440_bamboo.c ppc/{ppc440_bamboo, sam460ex}: use memdev for RAM 2020-02-19 16:50:00 +00:00
ppc440_pcix.c
ppc440_uc.c sysbus: Convert to sysbus_realize() etc. with Coccinelle 2020-06-15 22:05:28 +02:00
ppc440.h
ppc_booke.c
ppc.c
ppce500_spin.c
prep_systemio.c
prep.c sysbus: Convert to sysbus_realize() etc. with Coccinelle 2020-06-15 22:05:28 +02:00
rs6000_mc.c error: Avoid unnecessary error_propagate() after error_setg() 2020-07-10 15:18:08 +02:00
sam460ex.c sysbus: Convert to sysbus_realize() etc. with Coccinelle 2020-06-15 22:05:28 +02:00
spapr_caps.c qapi: Use returned bool to check for failure, Coccinelle part 2020-07-10 15:18:08 +02:00
spapr_cpu_core.c qdev: Use returned bool to check for qdev_realize() etc. failure 2020-07-10 15:01:06 +02:00
spapr_drc.c qom: Crash more nicely on object_property_get_link() failure 2020-07-10 15:18:08 +02:00
spapr_events.c ppc/spapr: Don't kill the guest if a recovered FWNMI machine check delivery fails 2020-04-07 08:55:10 +10:00
spapr_hcall.c qom: Crash more nicely on object_property_get_link() failure 2020-07-10 15:18:08 +02:00
spapr_iommu.c qdev: Convert bus-less devices to qdev_realize() with Coccinelle 2020-06-15 22:06:04 +02:00
spapr_irq.c qom: Put name parameter before value / visitor parameter 2020-07-10 15:18:08 +02:00
spapr_nvdimm.c spapr_nvdimm: Tweak error messages 2020-05-07 11:10:50 +10:00
spapr_ovec.c spapr: Rename DT functions to newer naming convention 2020-03-17 17:00:19 +11:00
spapr_pci_nvlink2.c qom: Crash more nicely on object_property_get_link() failure 2020-07-10 15:18:08 +02:00
spapr_pci_vfio.c
spapr_pci.c error: Avoid unnecessary error_propagate() after error_setg() 2020-07-10 15:18:08 +02:00
spapr_rng.c qom: Drop object_property_set_description() parameter @errp 2020-05-15 07:06:49 +02:00
spapr_rtas_ddw.c
spapr_rtas.c ppc/spapr: Add FWNMI machine check delivery warnings 2020-04-07 08:55:10 +10:00
spapr_rtc.c qom: Drop parameter @errp of object_property_add() & friends 2020-05-15 07:07:58 +02:00
spapr_tpm_proxy.c qdev: Unrealize must not fail 2020-05-15 07:08:14 +02:00
spapr_vio.c spapr: Fix typos in comments and macro indentation 2020-06-26 09:22:30 +10:00
spapr.c error: Avoid unnecessary error_propagate() after error_setg() 2020-07-10 15:18:08 +02:00
trace-events
virtex_ml507.c sysbus: Convert to sysbus_realize() etc. with Coccinelle 2020-06-15 22:05:28 +02:00