Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm: don't use idr_remove_all()

idr_destroy() can destroy idr by itself and idr_remove_all() is being
deprecated. Drop its usage.

* drm_ctxbitmap_cleanup() was calling idr_remove_all() but forgetting
idr_destroy() thus leaking all buffered free idr_layers. Replace it
with idr_destroy().

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: David Airlie <airlied@linux.ie>
Cc: Inki Dae <inki.dae@samsung.com>
Cc: Joonyoung Shim <jy0922.shim@samsung.com>
Cc: Seung-Woo Kim <sw0312.kim@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Tejun Heo and committed by
Linus Torvalds
4d53233a 748689d4

+1 -11
+1 -1
drivers/gpu/drm/drm_context.c
··· 118 118 void drm_ctxbitmap_cleanup(struct drm_device * dev) 119 119 { 120 120 mutex_lock(&dev->struct_mutex); 121 - idr_remove_all(&dev->ctx_idr); 121 + idr_destroy(&dev->ctx_idr); 122 122 mutex_unlock(&dev->struct_mutex); 123 123 } 124 124
-1
drivers/gpu/drm/drm_crtc.c
··· 1272 1272 crtc->funcs->destroy(crtc); 1273 1273 } 1274 1274 1275 - idr_remove_all(&dev->mode_config.crtc_idr); 1276 1275 idr_destroy(&dev->mode_config.crtc_idr); 1277 1276 } 1278 1277 EXPORT_SYMBOL(drm_mode_config_cleanup);
-1
drivers/gpu/drm/drm_drv.c
··· 297 297 298 298 unregister_chrdev(DRM_MAJOR, "drm"); 299 299 300 - idr_remove_all(&drm_minors_idr); 301 300 idr_destroy(&drm_minors_idr); 302 301 } 303 302
-2
drivers/gpu/drm/drm_gem.c
··· 561 561 { 562 562 idr_for_each(&file_private->object_idr, 563 563 &drm_gem_object_release_handle, file_private); 564 - 565 - idr_remove_all(&file_private->object_idr); 566 564 idr_destroy(&file_private->object_idr); 567 565 } 568 566
-4
drivers/gpu/drm/exynos/exynos_drm_ipp.c
··· 1786 1786 drm_iommu_detach_device(drm_dev, ippdrv->dev); 1787 1787 1788 1788 err_idr: 1789 - idr_remove_all(&ctx->ipp_idr); 1790 - idr_remove_all(&ctx->prop_idr); 1791 1789 idr_destroy(&ctx->ipp_idr); 1792 1790 idr_destroy(&ctx->prop_idr); 1793 1791 return ret; ··· 1963 1965 exynos_drm_subdrv_unregister(&ctx->subdrv); 1964 1966 1965 1967 /* remove,destroy ipp idr */ 1966 - idr_remove_all(&ctx->ipp_idr); 1967 - idr_remove_all(&ctx->prop_idr); 1968 1968 idr_destroy(&ctx->ipp_idr); 1969 1969 idr_destroy(&ctx->prop_idr); 1970 1970
-1
drivers/gpu/drm/sis/sis_drv.c
··· 58 58 { 59 59 drm_sis_private_t *dev_priv = dev->dev_private; 60 60 61 - idr_remove_all(&dev_priv->object_idr); 62 61 idr_destroy(&dev_priv->object_idr); 63 62 64 63 kfree(dev_priv);
-1
drivers/gpu/drm/via/via_map.c
··· 120 120 { 121 121 drm_via_private_t *dev_priv = dev->dev_private; 122 122 123 - idr_remove_all(&dev_priv->object_idr); 124 123 idr_destroy(&dev_priv->object_idr); 125 124 126 125 kfree(dev_priv);