[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH-for-5.1 v2 31/54] hw/riscv/sifive: Add missing error-propagation
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH-for-5.1 v2 31/54] hw/riscv/sifive: Add missing error-propagation code |
Date: |
Mon, 6 Apr 2020 19:47:20 +0200 |
Patch created mechanically by running:
$ spatch \
--macro-file scripts/cocci-macro-file.h --include-headers \
--sp-file scripts/coccinelle/use-error_propagate-in-realize.cocci \
--keep-comments --smpl-spacing --in-place --dir hw
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
hw/riscv/sifive_e.c | 6 +++++-
hw/riscv/sifive_u.c | 24 ++++++++++++++++++++----
2 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/hw/riscv/sifive_e.c b/hw/riscv/sifive_e.c
index 0be8b52147..6d4e141ff7 100644
--- a/hw/riscv/sifive_e.c
+++ b/hw/riscv/sifive_e.c
@@ -156,7 +156,11 @@ static void riscv_sifive_e_soc_realize(DeviceState *dev,
Error **errp)
MemoryRegion *sys_mem = get_system_memory();
object_property_set_bool(OBJECT(&s->cpus), true, "realized",
- &error_abort);
+ &err);
+ if (err) {
+ error_propagate(errp, err);
+ return;
+ }
/* MMIO */
s->plic = sifive_plic_create(memmap[SIFIVE_E_PLIC].base,
diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c
index e13ab34de4..b07526aba1 100644
--- a/hw/riscv/sifive_u.c
+++ b/hw/riscv/sifive_u.c
@@ -508,9 +508,17 @@ static void riscv_sifive_u_soc_realize(DeviceState *dev,
Error **errp)
NICInfo *nd = &nd_table[0];
object_property_set_bool(OBJECT(&s->e_cpus), true, "realized",
- &error_abort);
+ &err);
+ if (err) {
+ error_propagate(errp, err);
+ return;
+ }
object_property_set_bool(OBJECT(&s->u_cpus), true, "realized",
- &error_abort);
+ &err);
+ if (err) {
+ error_propagate(errp, err);
+ return;
+ }
/*
* The cluster must be realized after the RISC-V hart array container,
* as the container's CPU object is only created on realize, and the
@@ -518,9 +526,17 @@ static void riscv_sifive_u_soc_realize(DeviceState *dev,
Error **errp)
* cluster is realized.
*/
object_property_set_bool(OBJECT(&s->e_cluster), true, "realized",
- &error_abort);
+ &err);
+ if (err) {
+ error_propagate(errp, err);
+ return;
+ }
object_property_set_bool(OBJECT(&s->u_cluster), true, "realized",
- &error_abort);
+ &err);
+ if (err) {
+ error_propagate(errp, err);
+ return;
+ }
/* create PLIC hart topology configuration string */
plic_hart_config_len = (strlen(SIFIVE_U_PLIC_HART_CONFIG) + 1) *
--
2.21.1
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH-for-5.1 v2 31/54] hw/riscv/sifive: Add missing error-propagation code,
Philippe Mathieu-Daudé <=