drm/qxl: Use drmm_add_final_kfree
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 23 Mar 2020 14:49:06 +0000 (15:49 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 26 Mar 2020 13:50:05 +0000 (14:50 +0100)
With this we can drop the final kfree from the release function.

Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: virtualization@lists.linux-foundation.org
Cc: spice-devel@lists.freedesktop.org
Link: https://patchwork.freedesktop.org/patch/msgid/20200323144950.3018436-8-daniel.vetter@ffwll.ch
drivers/gpu/drm/qxl/qxl_drv.c
drivers/gpu/drm/qxl/qxl_kms.c

index 4fda3f9b29f464eb926ee97e2865df12e7affa19..09102e2efabc5e36d9d6eeff056bf92b06d07fd1 100644 (file)
@@ -144,8 +144,6 @@ static void qxl_drm_release(struct drm_device *dev)
         */
        qxl_modeset_fini(qdev);
        qxl_device_fini(qdev);
-       dev->dev_private = NULL;
-       kfree(qdev);
 }
 
 static void
index 70b20ee4741ae0b6f6522207b7b8136561486c24..09d7b5f6d17236664bcaa816ce04ff085120eebc 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/pci.h>
 
 #include <drm/drm_drv.h>
+#include <drm/drm_managed.h>
 #include <drm/drm_probe_helper.h>
 
 #include "qxl_drv.h"
@@ -121,6 +122,7 @@ int qxl_device_init(struct qxl_device *qdev,
        qdev->ddev.pdev = pdev;
        pci_set_drvdata(pdev, &qdev->ddev);
        qdev->ddev.dev_private = qdev;
+       drmm_add_final_kfree(&qdev->ddev, qdev);
 
        mutex_init(&qdev->gem.mutex);
        mutex_init(&qdev->update_area_mutex);