qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH-for-5.1 v2 06/54] hw/arm/aspeed_soc: Move some code from real


From: Cédric Le Goater
Subject: Re: [PATCH-for-5.1 v2 06/54] hw/arm/aspeed_soc: Move some code from realize() to init()
Date: Tue, 7 Apr 2020 08:47:02 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0

On 4/6/20 7:46 PM, Philippe Mathieu-Daudé wrote:
> Coccinelle reported:
> 
>   $ spatch ... --timeout 60 --sp-file \
>     scripts/coccinelle/simplify-init-realize-error_propagate.cocci
>   HANDLING: ./hw/arm/aspeed_soc.c
>   >>> possible moves from aspeed_soc_init() to aspeed_soc_realize() in 
> ./hw/arm/aspeed_soc.c:231
> 
> Move the calls using &error_fatal which don't depend of input
> updated before realize() to init().
> 
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>

Reviewed-by: Cédric Le Goater <address@hidden>

Thanks,

C. 

> ---
>  hw/arm/aspeed_soc.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c
> index 696c7fda14..debd7c8faa 100644
> --- a/hw/arm/aspeed_soc.c
> +++ b/hw/arm/aspeed_soc.c
> @@ -183,6 +183,7 @@ static void aspeed_soc_init(Object *obj)
>          snprintf(typename, sizeof(typename), "aspeed.spi%d-%s", i + 1, 
> socname);
>          sysbus_init_child_obj(obj, "spi[*]", OBJECT(&s->spi[i]),
>                                sizeof(s->spi[i]), typename);
> +        object_property_set_int(OBJECT(&s->spi[i]), 1, "num-cs", 
> &error_abort);
>      }
>  
>      for (i = 0; i < sc->ehcis_num; i++) {
> @@ -360,10 +361,7 @@ static void aspeed_soc_realize(DeviceState *dev, Error 
> **errp)
>  
>      /* SPI */
>      for (i = 0; i < sc->spis_num; i++) {
> -        object_property_set_int(OBJECT(&s->spi[i]), 1, "num-cs", &err);
> -        object_property_set_bool(OBJECT(&s->spi[i]), true, "realized",
> -                                 &local_err);
> -        error_propagate(&err, local_err);
> +        object_property_set_bool(OBJECT(&s->spi[i]), true, "realized", &err);
>          if (err) {
>              error_propagate(errp, err);
>              return;
> 




reply via email to

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