qemu/hw/timer
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
..
a9gtimer.c hw/timer: Introduce ARM A9 Global Timer. 2013-12-10 13:24:51 +00:00
allwinner-a10-pit.c savevm: Remove all the unneeded version_minimum_id_old (arm) 2014-05-13 16:09:35 +01:00
arm_mptimer.c sysbus: Set cannot_instantiate_with_device_add_yet 2013-12-23 00:27:22 +01:00
arm_timer.c savevm: Remove all the unneeded version_minimum_id_old (arm) 2014-05-13 16:09:35 +01:00
cadence_ttc.c savevm: Remove all the unneeded version_minimum_id_old (arm) 2014-05-13 16:09:35 +01:00
digic-timer.c savevm: Remove all the unneeded version_minimum_id_old (arm) 2014-05-13 16:09:35 +01:00
ds1338.c savevm: Remove all the unneeded version_minimum_id_old (arm) 2014-05-13 16:09:35 +01:00
etraxfs_timer.c aio / timers: Switch entire codebase to the new timer API 2013-08-22 19:14:24 +02:00
exynos4210_mct.c hw/timer/exynos4210_mct: Avoid overflow in exynos4210_ltick_recalc_count 2014-05-13 16:09:39 +01:00
exynos4210_pwm.c savevm: Remove all the unneeded version_minimum_id_old (arm) 2014-05-13 16:09:35 +01:00
exynos4210_rtc.c savevm: Remove all the unneeded version_minimum_id_old (arm) 2014-05-13 16:09:35 +01:00
grlib_gptimer.c hw/timer/grlib_gptimer: remove unnecessary assignment 2014-03-27 19:22:49 +04:00
hpet.c hpet: fix buffer overrun on invalid state load 2014-05-05 22:15:02 +02:00
i8254.c hw: Consistently name Error ** objects errp, and not err 2014-05-05 19:08:49 +02:00
i8254_common.c isa: Clean up use of cannot_instantiate_with_device_add_yet 2013-12-23 00:27:23 +01:00
imx_epit.c savevm: Remove all the unneeded version_minimum_id_old (arm) 2014-05-13 16:09:35 +01:00
imx_gpt.c savevm: Remove all the unneeded version_minimum_id_old (arm) 2014-05-13 16:09:35 +01:00
lm32_timer.c savevm: Remove all the unneeded version_minimum_id_old (rest) 2014-05-14 15:24:51 +02:00
m48t59.c qdev: Remove hex8/32/64 property types 2014-02-14 21:12:04 +01:00
Makefile.objs hw/timer: add allwinner a10 timer 2013-12-17 20:12:51 +00:00
mc146818rtc.c qapi: Replace uncommon use of the error API by the common one 2014-05-15 14:00:46 -04:00
milkymist-sysctl.c savevm: Remove all the unneeded version_minimum_id_old (rest) 2014-05-14 15:24:51 +02:00
omap_gptimer.c aio / timers: Switch entire codebase to the new timer API 2013-08-22 19:14:24 +02:00
omap_synctimer.c aio / timers: Switch entire codebase to the new timer API 2013-08-22 19:14:24 +02:00
pl031.c sysbus: Set cannot_instantiate_with_device_add_yet 2013-12-23 00:27:22 +01:00
puv3_ost.c aio / timers: Untangle include files 2013-08-22 19:10:27 +02:00
pxa2xx_timer.c savevm: Remove all the unneeded version_minimum_id_old (arm) 2014-05-13 16:09:35 +01:00
sh_timer.c aio / timers: Untangle include files 2013-08-22 19:10:27 +02:00
slavio_timer.c savevm: Remove all the unneeded version_minimum_id_old (rest) 2014-05-14 15:24:51 +02:00
tusb6010.c aio / timers: Switch entire codebase to the new timer API 2013-08-22 19:14:24 +02:00
twl92230.c savevm: Remove all the unneeded version_minimum_id_old (arm) 2014-05-13 16:09:35 +01:00
xilinx_timer.c xilinx_timer: Fix writes into TCSR register 2014-05-13 09:12:40 +10:00