qemu/hw/vfio
Greg Kurz c96f2c2a16 vfio-ccw: introduce vfio_ccw_get_device()
A recent patch fixed leaks of the dynamically allocated vcdev->vdev.name
field in vfio_ccw_realize(), but we now have three freeing sites for it.
This is unfortunate and seems to indicate something is wrong with its
life cycle.

The root issue is that vcdev->vdev.name is set before vfio_get_device()
is called, which theoretically prevents to call vfio_put_device() to
do the freeing. Well actually, we could call it anyway  because
vfio_put_base_device() is a nop if the device isn't attached, but this
would be confusing.

This patch hence moves all the logic of attaching the device, including
the "already attached" check, to a separate vfio_ccw_get_device() function,
counterpart of vfio_put_device(). While here, vfio_put_device() is renamed
to vfio_ccw_put_device() for consistency.

Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <152326891065.266543.9487977590811413472.stgit@bahia.lan>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2018-04-30 10:31:41 +02:00
..
amd-xgbe.c qdev: use device_class_set_parent_realize/unrealize/reset() 2018-02-05 13:54:38 +01:00
calxeda-xgmac.c qdev: use device_class_set_parent_realize/unrealize/reset() 2018-02-05 13:54:38 +01:00
ccw.c vfio-ccw: introduce vfio_ccw_get_device() 2018-04-30 10:31:41 +02:00
common.c vfio: Use a trace point when a RAM section cannot be DMA mapped 2018-04-05 10:48:52 -06:00
display.c ui: introduce vfio_display_reset 2018-04-27 11:36:34 +02:00
Makefile.objs vfio/display: core & wireup 2018-03-13 11:17:29 -06:00
pci-quirks.c vfio/pci: Add option to disable GeForce quirks 2018-02-06 11:08:27 -07:00
pci.c ui: introduce vfio_display_reset 2018-04-27 11:36:34 +02:00
pci.h ui: introduce vfio_display_reset 2018-04-27 11:36:34 +02:00
platform.c use g_path_get_basename instead of basename 2018-03-06 14:01:29 +01:00
spapr.c vfio, spapr: Fix levels calculation 2017-09-15 10:29:48 +10:00
trace-events vfio: Use a trace point when a RAM section cannot be DMA mapped 2018-04-05 10:48:52 -06:00