qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH-for-5.1 v3 21/24] hw/riscv/sifive_u: Move some code from real


From: Alistair Francis
Subject: Re: [PATCH-for-5.1 v3 21/24] hw/riscv/sifive_u: Move some code from realize() to init()
Date: Mon, 13 Apr 2020 15:16:09 -0700

On Sun, Apr 12, 2020 at 3:49 PM Philippe Mathieu-Daudé <address@hidden> wrote:
>
> Coccinelle reported:
>
>   $ spatch ... --timeout 60 --sp-file \
>     scripts/coccinelle/simplify-init-realize-error_propagate.cocci
>   HANDLING: ./hw/riscv/sifive_u.c
>   >>> possible moves from riscv_sifive_u_soc_init() to 
> riscv_sifive_u_soc_realize() in ./hw/riscv/sifive_u.c:473
>
> Move the calls using &error_abort which don't depend on input
> updated before realize() to init().
>
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>

Reviewed-by: Alistair Francis <address@hidden>

Alistair

> ---
> v3: Typo 'depend of' -> 'depend on' (eblake)
> ---
>  hw/riscv/sifive_u.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c
> index 9c90c94c33..754af19eef 100644
> --- a/hw/riscv/sifive_u.c
> +++ b/hw/riscv/sifive_u.c
> @@ -441,6 +441,8 @@ static void riscv_sifive_u_soc_init(Object *obj)
>      qdev_prop_set_uint32(DEVICE(&s->otp), "serial", OTP_SERIAL);
>      sysbus_init_child_obj(obj, "gem", &s->gem, sizeof(s->gem),
>                            TYPE_CADENCE_GEM);
> +    object_property_set_int(OBJECT(&s->gem), GEM_REVISION, "revision",
> +                            &error_abort);
>  }
>
>  static bool sifive_u_get_start_in_flash(Object *obj, Error **errp)
> @@ -569,8 +571,6 @@ static void riscv_sifive_u_soc_realize(DeviceState *dev, 
> Error **errp)
>          qemu_check_nic_model(nd, TYPE_CADENCE_GEM);
>          qdev_set_nic_properties(DEVICE(&s->gem), nd);
>      }
> -    object_property_set_int(OBJECT(&s->gem), GEM_REVISION, "revision",
> -                            &error_abort);
>      object_property_set_bool(OBJECT(&s->gem), true, "realized", &err);
>      if (err) {
>          error_propagate(errp, err);
> --
> 2.21.1
>
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]