[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH-for-5.0 09/12] hw/mips/mips_malta: Add missing error-propagat
From: |
Aleksandar Markovic |
Subject: |
Re: [PATCH-for-5.0 09/12] hw/mips/mips_malta: Add missing error-propagation code |
Date: |
Fri, 27 Mar 2020 00:49:46 +0200 |
21:19 Sre, 25.03.2020. Philippe Mathieu-Daudé <address@hidden> је написао/ла:
>
> Running the coccinelle script produced:
>
> $ spatch \
> --macro-file scripts/cocci-macro-file.h --include-headers \
> --sp-file scripts/coccinelle/object_property_missing_error_propagate.cocci \
> --keep-comments --smpl-spacing --dir hw
>
> [[manual check required: error_propagate() might be missing in object_property_set_int() hw/mips/mips_malta.c:1193:4]]
> [[manual check required: error_propagate() might be missing in object_property_set_str() hw/mips/mips_malta.c:1192:4]]
>
> Add the missing error_propagate() after manual review by adding
> a Error* parameter to create_cps().
>
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
> ---
> hw/mips/mips_malta.c | 19 ++++++++++++++-----
> 1 file changed, 14 insertions(+), 5 deletions(-)
>
> diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
> index e4c4de1b4e..8d43cfd41b 100644
> --- a/hw/mips/mips_malta.c
> +++ b/hw/mips/mips_malta.c
> @@ -1183,22 +1183,31 @@ static void create_cpu_without_cps(MachineState *ms,
> }
>
> static void create_cps(MachineState *ms, MaltaState *s,
> - qemu_irq *cbus_irq, qemu_irq *i8259_irq)
> + qemu_irq *cbus_irq, qemu_irq *i8259_irq,
> + Error **errp)
> {
> Error *err = NULL;
>
> sysbus_init_child_obj(OBJECT(s), "cps", OBJECT(&s->cps), sizeof(s->cps),
> TYPE_MIPS_CPS);
> object_property_set_str(OBJECT(&s->cps), ms->cpu_type, "cpu-type", &err);
> + if (err) {
> + error_propagate(errp, err);
> + return;
> + }
> object_property_set_int(OBJECT(&s->cps), ms->smp.cpus, "num-vp", &err);
> + if (err) {
> + error_propagate(errp, err);
> + return;
> + }
> object_property_set_bool(OBJECT(&s->cps), true, "realized", &err);
> - if (err != NULL) {
> - error_report("%s", error_get_pretty(err));
> - exit(1);
> + if (err) {
> + error_propagate(errp, err);
> + return;
> }
>
> sysbus_mmio_map_overlap(SYS_BUS_DEVICE(&s->cps), 0, 0, 1);
>
> *i8259_irq = get_cps_irq(&s->cps, 3);
> *cbus_irq = NULL;
> }
> @@ -1206,9 +1215,9 @@ static void create_cps(MachineState *ms, MaltaState *s,
> static void mips_create_cpu(MachineState *ms, MaltaState *s,
> qemu_irq *cbus_irq, qemu_irq *i8259_irq)
> {
> if ((ms->smp.cpus > 1) && cpu_supports_cps_smp(ms->cpu_type)) {
> - create_cps(ms, s, cbus_irq, i8259_irq);
> + create_cps(ms, s, cbus_irq, i8259_irq, &error_fatal);
> } else {
> create_cpu_without_cps(ms, cbus_irq, i8259_irq);
> }
> }
> --
> 2.21.1
>
Reviewed-by: Aleksandar Markovic <address@hidden>
- Re: [PATCH-for-5.0 06/12] hw/dma/xilinx_axidma: Add missing error-propagation code, (continued)
- [PATCH-for-5.0 07/12] hw/mips/cps: Add missing error-propagation code, Philippe Mathieu-Daudé, 2020/03/25
- [PATCH-for-5.0 08/12] hw/mips/boston: Add missing error-propagation code, Philippe Mathieu-Daudé, 2020/03/25
- [PATCH-for-5.0 09/12] hw/mips/mips_malta: Add missing error-propagation code, Philippe Mathieu-Daudé, 2020/03/25
- [PATCH-for-5.0 10/12] hw/misc/macio/macio: Add missing error-propagation code, Philippe Mathieu-Daudé, 2020/03/25
- [PATCH-for-5.0 11/12] hw/net/xilinx_axienet: Add missing error-propagation code, Philippe Mathieu-Daudé, 2020/03/25
- [PATCH-for-5.0 12/12] hw/riscv/sifive_u: Add missing error-propagation code, Philippe Mathieu-Daudé, 2020/03/25