aboutsummaryrefslogtreecommitdiff
path: root/hw/arm/cubieboard.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2020-07-07 18:05:56 +0200
committerMarkus Armbruster <armbru@redhat.com>2020-07-10 15:18:08 +0200
commit778a2dc59213d789f5bf8409547b529af4eb9ead (patch)
tree5fa10bb05617c2d20de9d7daf5376a85914e3967 /hw/arm/cubieboard.c
parent6fd5bef10b8f0bf64df4e800bfda1da5fe17ca82 (diff)
qom: Use returned bool to check for failure, Coccinelle part
The previous commit enables conversion of foo(..., &err); if (err) { ... } to if (!foo(..., errp)) { ... } for QOM functions that now return true / false on success / error. Coccinelle script: @@ identifier fun = { object_apply_global_props, object_initialize_child_with_props, object_initialize_child_with_propsv, object_property_get, object_property_get_bool, object_property_parse, object_property_set, object_property_set_bool, object_property_set_int, object_property_set_link, object_property_set_qobject, object_property_set_str, object_property_set_uint, object_set_props, object_set_propv, user_creatable_add_dict, user_creatable_complete, user_creatable_del }; expression list args, args2; typedef Error; Error *err; @@ - fun(args, &err, args2); - if (err) + if (!fun(args, &err, args2)) { ... } Fails to convert hw/arm/armsse.c, because Coccinelle gets confused by ARMSSE being used both as typedef and function-like macro there. Convert manually. Line breaks tidied up manually. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-Id: <20200707160613.848843-29-armbru@redhat.com>
Diffstat (limited to 'hw/arm/cubieboard.c')
-rw-r--r--hw/arm/cubieboard.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/hw/arm/cubieboard.c b/hw/arm/cubieboard.c
index 302919246b..1c6c792eb6 100644
--- a/hw/arm/cubieboard.c
+++ b/hw/arm/cubieboard.c
@@ -62,20 +62,19 @@ static void cubieboard_init(MachineState *machine)
object_property_add_child(OBJECT(machine), "soc", OBJECT(a10));
object_unref(OBJECT(a10));
- object_property_set_int(OBJECT(&a10->emac), "phy-addr", 1, &err);
- if (err != NULL) {
+ if (!object_property_set_int(OBJECT(&a10->emac), "phy-addr", 1, &err)) {
error_reportf_err(err, "Couldn't set phy address: ");
exit(1);
}
- object_property_set_int(OBJECT(&a10->timer), "clk0-freq", 32768, &err);
- if (err != NULL) {
+ if (!object_property_set_int(OBJECT(&a10->timer), "clk0-freq", 32768,
+ &err)) {
error_reportf_err(err, "Couldn't set clk0 frequency: ");
exit(1);
}
- object_property_set_int(OBJECT(&a10->timer), "clk1-freq", 24000000, &err);
- if (err != NULL) {
+ if (!object_property_set_int(OBJECT(&a10->timer), "clk1-freq", 24000000,
+ &err)) {
error_reportf_err(err, "Couldn't set clk1 frequency: ");
exit(1);
}