From: Egbert Eich <eich@xxxxxxx> Cursor BOs should be cleaned up properly on error or when unloading the driver. Signed-off-by: Egbert Eich <eich@xxxxxxx> Signed-off-by: Takashi Iwai <tiwai@xxxxxxx> --- drivers/gpu/drm/mgag200/mgag200_main.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/mgag200/mgag200_main.c b/drivers/gpu/drm/mgag200/mgag200_main.c index 87c5469d06a7..73614154a5ef 100644 --- a/drivers/gpu/drm/mgag200/mgag200_main.c +++ b/drivers/gpu/drm/mgag200/mgag200_main.c @@ -354,9 +354,12 @@ int mgag200_driver_load(struct drm_device *dev, unsigned long flags) /* Make small buffers to store a hardware cursor (double buffered icon updates) */ mgag200_bo_create(dev, roundup(48*64, PAGE_SIZE), 0, 0, &mdev->cursor.pixels_1); - mgag200_bo_create(dev, roundup(48*64, PAGE_SIZE), 0, 0, - &mdev->cursor.pixels_2); + if (mdev->cursor.pixels_1) + mgag200_bo_create(dev, roundup(48*64, PAGE_SIZE), 0, 0, + &mdev->cursor.pixels_2); if (!mdev->cursor.pixels_2 || !mdev->cursor.pixels_1) { + if (mdev->cursor.pixels_1) + drm_gem_object_unreference_unlocked(&mdev->cursor.pixels_1->gem); mdev->cursor.pixels_1 = NULL; mdev->cursor.pixels_2 = NULL; dev_warn(&dev->pdev->dev, @@ -384,6 +387,10 @@ void mgag200_driver_unload(struct drm_device *dev) if (mdev == NULL) return; mgag200_modeset_fini(mdev); + if (mdev->cursor.pixels_1) + drm_gem_object_unreference_unlocked(&mdev->cursor.pixels_1->gem); + if (mdev->cursor.pixels_2) + drm_gem_object_unreference_unlocked(&mdev->cursor.pixels_2->gem); mgag200_fbdev_fini(mdev); drm_mode_config_cleanup(dev); mgag200_mm_fini(mdev); -- 2.13.2 _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel