From 058acb33d100c5cceab10d2dd388cf9bc0918908 Mon Sep 17 00:00:00 2001 From: Xie Yongji Date: Mon, 17 May 2021 16:49:13 +0800 Subject: [PATCH] drm/virtio: free virtqueues on probe failure We should call virtio_gpu_deinit() to free virtqueues when drm_dev_register() failed. Signed-off-by: Xie Yongji Link: http://patchwork.freedesktop.org/patch/msgid/20210517084913.403-3-xieyongji@bytedance.com Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.c b/drivers/gpu/drm/virtio/virtgpu_drv.c index 33bf5f53ae31..ca77edbc5ea0 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drv.c +++ b/drivers/gpu/drm/virtio/virtgpu_drv.c @@ -125,11 +125,13 @@ static int virtio_gpu_probe(struct virtio_device *vdev) ret = drm_dev_register(dev, 0); if (ret) - goto err_free; + goto err_deinit; drm_fbdev_generic_setup(vdev->priv, 32); return 0; +err_deinit: + virtio_gpu_deinit(dev); err_free: drm_dev_put(dev); return ret;