drm/virtio: fix resource id handling
authorGerd Hoffmann <kraxel@redhat.com>
Fri, 19 Oct 2018 06:18:47 +0000 (08:18 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Mon, 29 Oct 2018 21:50:55 +0000 (22:50 +0100)
commit6c1cd97bdaffa2ae1dbdc8a0857931308ac647cd
tree5a23cc28ebea931ff5d800dcff7a9268e3bb0fbe
parent724cfdfd667a28dbfb5365b76df4ccf39cf9a09a
drm/virtio: fix resource id handling

Move virtio_gpu_resource_id_{get,put} to virtgpu_object.c and make them
static.  Allocate and free the id on creation and destroy, drop all
other calls.  That way objects have a valid handle for the whole
lifetime of the object.

Also fixes ids leaking.  Worst offender are dumb buffers, and I think
some error paths too.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20181019061847.18958-7-kraxel@redhat.com
drivers/gpu/drm/virtio/virtgpu_drv.h
drivers/gpu/drm/virtio/virtgpu_fb.c
drivers/gpu/drm/virtio/virtgpu_gem.c
drivers/gpu/drm/virtio/virtgpu_ioctl.c
drivers/gpu/drm/virtio/virtgpu_object.c
drivers/gpu/drm/virtio/virtgpu_vq.c