qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 08/55] qdev: Convert uses of qdev_create() with Coccinelle


From: Paolo Bonzini
Subject: Re: [PATCH 08/55] qdev: Convert uses of qdev_create() with Coccinelle
Date: Wed, 20 May 2020 08:30:01 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0

On 19/05/20 16:55, Markus Armbruster wrote:
>     expression bus, type_name, dev;
>     @@
>     -    dev = qdev_create(bus, type_name);
>     +    dev = qdev_new(type_name);
>          ...
>     -    qdev_init_nofail(dev);
>     +    qdev_realize_and_unref(dev, bus, &error_fatal);
> 

> The first rule exempts hw/arm/highbank.c, because it matches along two
> control flow paths there, with different @type_name.  Covered by the
> next commit's manual conversions.

Slightly better way to express it:

     expression bus, type_name, dev;
     @@
     -    dev = qdev_create(bus, type_name);
     +    dev = qdev_new(type_name);
          ... when != dev = qdev_create(...)
     -    qdev_init_nofail(dev);
     +    qdev_realize_and_unref(dev, bus, &error_fatal);

(Just for documentation purposes, the patch is okay of course).

Paolo




reply via email to

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