aboutsummaryrefslogtreecommitdiff
path: root/hw/arm/armsse.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/armsse.c
parent6fd5bef10b8f0bf64df4e800bfda1da5fe17ca82 (diff)
downloadqemu-778a2dc59213d789f5bf8409547b529af4eb9ead.zip
qemu-778a2dc59213d789f5bf8409547b529af4eb9ead.tar.gz
qemu-778a2dc59213d789f5bf8409547b529af4eb9ead.tar.bz2
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/armsse.c')
-rw-r--r--hw/arm/armsse.c52
1 files changed, 22 insertions, 30 deletions
diff --git a/hw/arm/armsse.c b/hw/arm/armsse.c
index 1f8ce94..c860492 100644
--- a/hw/arm/armsse.c
+++ b/hw/arm/armsse.c
@@ -534,22 +534,20 @@ static void armsse_realize(DeviceState *dev, Error **errp)
* later if necessary.
*/
if (extract32(info->cpuwait_rst, i, 1)) {
- object_property_set_bool(cpuobj, "start-powered-off", true, &err);
- if (err) {
+ if (!object_property_set_bool(cpuobj, "start-powered-off", true,
+ &err)) {
error_propagate(errp, err);
return;
}
}
if (!s->cpu_fpu[i]) {
- object_property_set_bool(cpuobj, "vfp", false, &err);
- if (err) {
+ if (!object_property_set_bool(cpuobj, "vfp", false, &err)) {
error_propagate(errp, err);
return;
}
}
if (!s->cpu_dsp[i]) {
- object_property_set_bool(cpuobj, "dsp", false, &err);
- if (err) {
+ if (!object_property_set_bool(cpuobj, "dsp", false, &err)) {
error_propagate(errp, err);
return;
}
@@ -604,9 +602,8 @@ static void armsse_realize(DeviceState *dev, Error **errp)
DeviceState *devs = DEVICE(splitter);
int cpunum;
- object_property_set_int(splitter, "num-lines", info->num_cpus,
- &err);
- if (err) {
+ if (!object_property_set_int(splitter, "num-lines",
+ info->num_cpus, &err)) {
error_propagate(errp, err);
return;
}
@@ -658,9 +655,8 @@ static void armsse_realize(DeviceState *dev, Error **errp)
* multiple lines, one for each of the PPCs within the ARMSSE and one
* that will be an output from the ARMSSE to the system.
*/
- object_property_set_int(OBJECT(&s->sec_resp_splitter), "num-lines", 3,
- &err);
- if (err) {
+ if (!object_property_set_int(OBJECT(&s->sec_resp_splitter),
+ "num-lines", 3, &err)) {
error_propagate(errp, err);
return;
}
@@ -702,9 +698,9 @@ static void armsse_realize(DeviceState *dev, Error **errp)
}
/* We must OR together lines from the MPC splitters to go to the NVIC */
- object_property_set_int(OBJECT(&s->mpc_irq_orgate), "num-lines",
- IOTS_NUM_EXP_MPC + info->sram_banks, &err);
- if (err) {
+ if (!object_property_set_int(OBJECT(&s->mpc_irq_orgate), "num-lines",
+ IOTS_NUM_EXP_MPC + info->sram_banks,
+ &err)) {
error_propagate(errp, err);
return;
}
@@ -841,9 +837,8 @@ static void armsse_realize(DeviceState *dev, Error **errp)
* ones) are sent individually to the security controller, and also
* ORed together to give a single combined PPC interrupt to the NVIC.
*/
- object_property_set_int(OBJECT(&s->ppc_irq_orgate), "num-lines", NUM_PPCS,
- &err);
- if (err) {
+ if (!object_property_set_int(OBJECT(&s->ppc_irq_orgate),
+ "num-lines", NUM_PPCS, &err)) {
error_propagate(errp, err);
return;
}
@@ -949,15 +944,13 @@ static void armsse_realize(DeviceState *dev, Error **errp)
qdev_get_gpio_in_named(dev_apb_ppc1,
"cfg_sec_resp", 0));
- object_property_set_int(OBJECT(&s->sysinfo), "SYS_VERSION",
- info->sys_version, &err);
- if (err) {
+ if (!object_property_set_int(OBJECT(&s->sysinfo), "SYS_VERSION",
+ info->sys_version, &err)) {
error_propagate(errp, err);
return;
}
- object_property_set_int(OBJECT(&s->sysinfo), "SYS_CONFIG",
- armsse_sys_config_value(s, info), &err);
- if (err) {
+ if (!object_property_set_int(OBJECT(&s->sysinfo), "SYS_CONFIG",
+ armsse_sys_config_value(s, info), &err)) {
error_propagate(errp, err);
return;
}
@@ -1005,8 +998,8 @@ static void armsse_realize(DeviceState *dev, Error **errp)
}
/* This OR gate wires together outputs from the secure watchdogs to NMI */
- object_property_set_int(OBJECT(&s->nmi_orgate), "num-lines", 2, &err);
- if (err) {
+ if (!object_property_set_int(OBJECT(&s->nmi_orgate), "num-lines", 2,
+ &err)) {
error_propagate(errp, err);
return;
}
@@ -1049,8 +1042,7 @@ static void armsse_realize(DeviceState *dev, Error **errp)
for (i = 0; i < ARRAY_SIZE(s->ppc_irq_splitter); i++) {
Object *splitter = OBJECT(&s->ppc_irq_splitter[i]);
- object_property_set_int(splitter, "num-lines", 2, &err);
- if (err) {
+ if (!object_property_set_int(splitter, "num-lines", 2, &err)) {
error_propagate(errp, err);
return;
}
@@ -1095,8 +1087,8 @@ static void armsse_realize(DeviceState *dev, Error **errp)
SplitIRQ *splitter = &s->mpc_irq_splitter[i];
DeviceState *dev_splitter = DEVICE(splitter);
- object_property_set_int(OBJECT(splitter), "num-lines", 2, &err);
- if (err) {
+ if (!object_property_set_int(OBJECT(splitter), "num-lines", 2,
+ &err)) {
error_propagate(errp, err);
return;
}