qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 1/2] hw/ipmi/bmc: Delay timer_new_ns() from init to realize t


From: Peter Maydell
Subject: Re: [PATCH 1/2] hw/ipmi/bmc: Delay timer_new_ns() from init to realize to avoid memleaks
Date: Mon, 17 Feb 2020 17:27:13 +0000

On Mon, 17 Feb 2020 at 17:20, Philippe Mathieu-Daudé <address@hidden> wrote:
> Quick check with TYPE_BITBAND which is a SysBus device, we have:
>
> static void bitband_realize(DeviceState *dev, Error **errp)
> {
>      BitBandState *s = BITBAND(dev);
>
>      if (!s->source_memory) {
>          error_setg(errp, "source-memory property not set");
>          return;
>      }
>
>      address_space_init(&s->source_as, s->source_memory, "bitband-source");
> }
>
> Do we need the equivalent:
>
> static void bitband_unrealize(DeviceState *dev, Error **errp)
> {
>      BitBandState *s = BITBAND(dev);
>
>      address_space_destroy(&s->source_as);
> }
>
> Or instead mark the device user_creatable=false because of the link to a
> TYPE_MEMORY_REGION?

I don't believe that this device is user-creatable. The
base class sysbus_device_class_init() sets user_creatable
to false by default for all sysbus devices, and a sysbus
device which wants to opt into being user-created has to
set it to true.

Also the device's type name string is "ARM,bitband-memory"
and the -device option at least does not like the comma
in the middle of the name, so I don't know how you'd
create it on the command line even if it wasn't marked
not user-creatable.

thanks
-- PMM



reply via email to

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