linux-xiaomi-chiron/drivers/vfio/mdev
Jason Gunthorpe fbd0e2b0c3 vfio/mdev: Reorganize mdev_device_create()
Once the memory for the struct mdev_device is allocated it should
immediately be device_initialize()'d and filled in so that put_device()
can always be used to undo the allocation.

Place the mdev_get/put_parent() so that they are clearly protecting the
mdev->parent pointer. Move the final put to the release function so that
the lifetime rules are trivial to understand. Update the goto labels to
follow the normal convention.

Remove mdev_device_free() as the release function via device_put() is now
usable in all cases.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Message-Id: <8-v2-d36939638fc6+d54-vfio2_jgg@nvidia.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2021-04-07 15:39:18 -06:00
..
Kconfig docs: driver-api: add a series of orphaned documents 2019-07-15 11:03:02 -03:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
mdev_core.c vfio/mdev: Reorganize mdev_device_create() 2021-04-07 15:39:18 -06:00
mdev_driver.c vfio/mdev: Simplify driver registration 2021-04-07 15:39:16 -06:00
mdev_private.h vfio/mdev: Expose mdev_get/put_parent to mdev_private.h 2021-04-07 15:39:17 -06:00
mdev_sysfs.c vfio/mdev: Add missing reference counting to mdev_type 2021-04-07 15:39:17 -06:00
vfio_mdev.c vfio/mdev: Simplify driver registration 2021-04-07 15:39:16 -06:00