All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/drm_pci.c: Use dma_zalloc_coherent
@ 2018-10-23  4:02 Souptick Joarder
  2018-10-23 13:58 ` Daniel Vetter
  0 siblings, 1 reply; 2+ messages in thread
From: Souptick Joarder @ 2018-10-23  4:02 UTC (permalink / raw)
  To: gustavo, maarten.lankhorst, sean, airlied
  Cc: dri-devel, linux-kernel, sabyasachi.linux, brajeswar.linux

Replace dma_alloc_coherent + memset with dma_zalloc_coherent.

Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
---
 drivers/gpu/drm/drm_pci.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
index 896e42a..1427879 100644
--- a/drivers/gpu/drm/drm_pci.c
+++ b/drivers/gpu/drm/drm_pci.c
@@ -61,15 +61,14 @@ drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t ali
 		return NULL;
 
 	dmah->size = size;
-	dmah->vaddr = dma_alloc_coherent(&dev->pdev->dev, size, &dmah->busaddr, GFP_KERNEL | __GFP_COMP);
+	dmah->vaddr = dma_zalloc_coherent(&dev->pdev->dev, size, &dmah->busaddr,
+						GFP_KERNEL | __GFP_COMP);
 
 	if (dmah->vaddr == NULL) {
 		kfree(dmah);
 		return NULL;
 	}
 
-	memset(dmah->vaddr, 0, size);
-
 	/* XXX - Is virt_to_page() legal for consistent mem? */
 	/* Reserve */
 	for (addr = (unsigned long)dmah->vaddr, sz = size;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/drm_pci.c: Use dma_zalloc_coherent
  2018-10-23  4:02 [PATCH] drm/drm_pci.c: Use dma_zalloc_coherent Souptick Joarder
@ 2018-10-23 13:58 ` Daniel Vetter
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Vetter @ 2018-10-23 13:58 UTC (permalink / raw)
  To: Souptick Joarder
  Cc: gustavo, maarten.lankhorst, sean, airlied, brajeswar.linux,
	linux-kernel, dri-devel, sabyasachi.linux

On Tue, Oct 23, 2018 at 09:32:22AM +0530, Souptick Joarder wrote:
> Replace dma_alloc_coherent + memset with dma_zalloc_coherent.
> 
> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>

Applied, thanks for your patch.
-Daniel

> ---
>  drivers/gpu/drm/drm_pci.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
> index 896e42a..1427879 100644
> --- a/drivers/gpu/drm/drm_pci.c
> +++ b/drivers/gpu/drm/drm_pci.c
> @@ -61,15 +61,14 @@ drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t ali
>  		return NULL;
>  
>  	dmah->size = size;
> -	dmah->vaddr = dma_alloc_coherent(&dev->pdev->dev, size, &dmah->busaddr, GFP_KERNEL | __GFP_COMP);
> +	dmah->vaddr = dma_zalloc_coherent(&dev->pdev->dev, size, &dmah->busaddr,
> +						GFP_KERNEL | __GFP_COMP);
>  
>  	if (dmah->vaddr == NULL) {
>  		kfree(dmah);
>  		return NULL;
>  	}
>  
> -	memset(dmah->vaddr, 0, size);
> -
>  	/* XXX - Is virt_to_page() legal for consistent mem? */
>  	/* Reserve */
>  	for (addr = (unsigned long)dmah->vaddr, sz = size;
> -- 
> 1.9.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-10-23 13:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-23  4:02 [PATCH] drm/drm_pci.c: Use dma_zalloc_coherent Souptick Joarder
2018-10-23 13:58 ` Daniel Vetter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.