[PATCH] drm: Remove some useless memset

Christophe JAILLET christophe.jaillet at wanadoo.fr
Thu Dec 9 22:03:00 UTC 2021


'bufs' is an array embedded in an structure (struct drm_device_dma) which
is kzalloc just a few lines above.
So there is no need to explicitly memset each element on the array. It is
already cleared.

Remove the useless memset.

Signed-off-by: Christophe JAILLET <christophe.jaillet at wanadoo.fr>
---
 drivers/gpu/drm/drm_dma.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/gpu/drm/drm_dma.c b/drivers/gpu/drm/drm_dma.c
index eb6b741a6f99..df4837dc5030 100644
--- a/drivers/gpu/drm/drm_dma.c
+++ b/drivers/gpu/drm/drm_dma.c
@@ -51,8 +51,6 @@
  */
 int drm_legacy_dma_setup(struct drm_device *dev)
 {
-	int i;
-
 	if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA) ||
 	    !drm_core_check_feature(dev, DRIVER_LEGACY))
 		return 0;
@@ -64,9 +62,6 @@ int drm_legacy_dma_setup(struct drm_device *dev)
 	if (!dev->dma)
 		return -ENOMEM;
 
-	for (i = 0; i <= DRM_MAX_ORDER; i++)
-		memset(&dev->dma->bufs[i], 0, sizeof(dev->dma->bufs[0]));
-
 	return 0;
 }
 
-- 
2.32.0



More information about the dri-devel mailing list