qemu-e2k/hw
Markus Armbruster 297a3646c2 qapi: Replace uncommon use of the error API by the common one
We commonly use the error API like this:

    err = NULL;
    foo(..., &err);
    if (err) {
        goto out;
    }
    bar(..., &err);

Every error source is checked separately.  The second function is only
called when the first one succeeds.  Both functions are free to pass
their argument to error_set().  Because error_set() asserts no error
has been set, this effectively means they must not be called with an
error set.

The qapi-generated code uses the error API differently:

    // *errp was initialized to NULL somewhere up the call chain
    frob(..., errp);
    gnat(..., errp);

Errors accumulate in *errp: first error wins, subsequent errors get
dropped.  To make this work, the second function does nothing when
called with an error set.  Requires non-null errp, or else the second
function can't see the first one fail.

This usage has also bled into visitor tests, and two device model
object property getters rtc_get_date() and balloon_stats_get_all().

With the "accumulate" technique, you need fewer error checks in
callers, and buy that with an error check in every callee.  Can be
nice.

However, mixing the two techniques is confusing.  You can't use the
"accumulate" technique with functions designed for the "check
separately" technique.  You can use the "check separately" technique
with functions designed for the "accumulate" technique, but then
error_set() can't catch you setting an error more than once.

Standardize on the "check separately" technique for now, because it's
overwhelmingly prevalent.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2014-05-15 14:00:46 -04:00
..
9pfs hw/9pfs: Add include file for exported symbol 2014-05-07 21:00:43 +04:00
acpi acpi/pcihp.c: Rewrite acpi_pcihp_get_bsel using object_property_get_int 2014-05-07 12:13:42 +03:00
alpha
arm hw/arm/stellaris: Correct handling of GPTM TAR register 2014-05-13 16:09:39 +01:00
audio migration/next for 20140515 2014-05-15 17:29:03 +01:00
block migration/next for 20140515 2014-05-15 17:29:03 +01:00
bt
char migration/next for 20140515 2014-05-15 17:29:03 +01:00
core savevm: Remove all the unneeded version_minimum_id_old (rest) 2014-05-14 15:24:51 +02:00
cpu
cris
display migration/next for 20140515 2014-05-15 17:29:03 +01:00
dma migration/next for 20140515 2014-05-15 17:29:03 +01:00
gpio savevm: Remove all the unneeded version_minimum_id_old (arm) 2014-05-13 16:09:35 +01:00
i2c savevm: Remove all the unneeded version_minimum_id_old (rest) 2014-05-14 15:24:51 +02:00
i386 pc: port 92 reset requires a low->high transition 2014-05-13 13:22:29 +02:00
ide savevm: Remove all the unneeded version_minimum_id_old (rest) 2014-05-14 15:24:51 +02:00
input migration/next for 20140515 2014-05-15 17:29:03 +01:00
intc migration/next for 20140515 2014-05-15 17:29:03 +01:00
ipack savevm: Remove all the unneeded version_minimum_id_old (rest) 2014-05-14 15:24:51 +02:00
isa PortioList: Store PortioList in device state 2014-05-05 20:58:33 +02:00
lm32
m68k
microblaze microblaze: boot: Don't hack the elf entry point 2014-05-13 09:12:40 +10:00
mips hw/mips: Add missing 'static' and 'const' attributes 2014-05-07 21:00:43 +04:00
misc migration/next for 20140515 2014-05-15 17:29:03 +01:00
moxie
net migration/next for 20140515 2014-05-15 17:29:03 +01:00
nvram savevm: Remove all the unneeded version_minimum_id_old (rest) 2014-05-14 15:24:51 +02:00
openrisc
pci pci: add Error-propagating pci_add_capability2() 2014-05-08 14:19:59 -04:00
pci-bridge
pci-host savevm: Remove all the unneeded version_minimum_id_old (rest) 2014-05-14 15:24:51 +02:00
pcmcia
ppc hw: Add missing 'static' attributes 2014-05-07 21:00:43 +04:00
s390x savevm: Remove all the unneeded version_minimum_id_old (rest) 2014-05-14 15:24:51 +02:00
scsi savevm: Remove all the unneeded version_minimum_id_old (rest) 2014-05-14 15:24:51 +02:00
sd savevm: Remove all the unneeded version_minimum_id_old (rest) 2014-05-14 15:24:51 +02:00
sh4
sparc
sparc64
ssi savevm: Remove all the unneeded version_minimum_id_old (arm) 2014-05-13 16:09:35 +01:00
timer qapi: Replace uncommon use of the error API by the common one 2014-05-15 14:00:46 -04:00
tpm
unicore32
usb usb: fix up post load checks 2014-05-14 15:24:52 +02:00
virtio qapi: Replace uncommon use of the error API by the common one 2014-05-15 14:00:46 -04:00
watchdog PortioList: Store PortioList in device state 2014-05-05 20:58:33 +02:00
xen trivial patches for 2014-05-07 2014-05-07 18:38:39 +01:00
xenpv xen: move Xen PV machine files to hw/xenpv 2014-05-07 16:14:50 +00:00
xtensa
Makefile.objs