Skip to contentSkip to conversation

gpu/drm/virtio/virtgpu_vq.c: Use kmem_cache_zalloc

PATCH In review Sabyasachi Gupta 4 participants 6 messages Oct 19, 2018 – Oct 30, 2018

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpu/drm/virtio/virtgpu_vq.c: Use kmem_cache_zalloc

Replaced kmem_cache_alloc + memset with kmem_cache_zalloc

---
 drivers/gpu/drm/virtio/virtgpu_vq.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/virtio/virtgpu_vq.c +1 -2
index 020070d..e001b79 100644
@@ -98,10 +98,9 @@ virtio_gpu_get_vbuf(struct virtio_gpu_device *vgdev,
 {
 	struct virtio_gpu_vbuffer *vbuf;
 
-	vbuf = kmem_cache_alloc(vgdev->vbufs, GFP_KERNEL);
+	vbuf = kmem_cache_zalloc(vgdev->vbufs, GFP_KERNEL);
 	if (!vbuf)
 		return ERR_PTR(-ENOMEM);
-	memset(vbuf, 0, VBUFFER_SIZE);
 
 	BUG_ON(size > MAX_INLINE_CMD_SIZE);
 	vbuf->buf = (void *)vbuf + sizeof(*vbuf);
Signature · 1 line
2.7.4
#1 lore raw
Quoted 2 lines · Sabyasachi Gupta

Replaced kmem_cache_alloc + memset with kmem_cache_zalloc

Put a new line gap in between these two lines and send v2.

Quoted 24 lines
---
 drivers/gpu/drm/virtio/virtgpu_vq.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/virtio/virtgpu_vq.c +1 -3
index 020070d..e001b79 100644
@@ -98,10 +98,9 @@ virtio_gpu_get_vbuf(struct virtio_gpu_device *vgdev,
 {
        struct virtio_gpu_vbuffer *vbuf;
 
-       vbuf = kmem_cache_alloc(vgdev->vbufs, GFP_KERNEL);
+       vbuf = kmem_cache_zalloc(vgdev->vbufs, GFP_KERNEL);
        if (!vbuf)
                return ERR_PTR(-ENOMEM);
-       memset(vbuf, 0, VBUFFER_SIZE);
 
        BUG_ON(size > MAX_INLINE_CMD_SIZE);
        vbuf->buf = (void *)vbuf + sizeof(*vbuf);
--

2.7.4

Reviewed-by
#2 lore raw
Quoted 6 lines · Souptick Joarder
Quoted 2 lines · Sabyasachi Gupta

Replaced kmem_cache_alloc + memset with kmem_cache_zalloc

Put a new line gap in between these two lines and send v2.

Nah, the maintainers can trivially add the newline while applying. Review is much more valuable than nitpicking on the commit message.

Quoted 29 lines
Quoted 23 lines
---
 drivers/gpu/drm/virtio/virtgpu_vq.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/virtio/virtgpu_vq.c +1 -3
index 020070d..e001b79 100644
@@ -98,10 +98,9 @@ virtio_gpu_get_vbuf(struct virtio_gpu_device *vgdev,
 {
        struct virtio_gpu_vbuffer *vbuf;
 
-       vbuf = kmem_cache_alloc(vgdev->vbufs, GFP_KERNEL);
+       vbuf = kmem_cache_zalloc(vgdev->vbufs, GFP_KERNEL);
        if (!vbuf)
                return ERR_PTR(-ENOMEM);
-       memset(vbuf, 0, VBUFFER_SIZE);
 
        BUG_ON(size > MAX_INLINE_CMD_SIZE);
        vbuf->buf = (void *)vbuf + sizeof(*vbuf);
--
Quoted 2 lines

2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
maintainer
#3 lore raw
Quoted 11 lines · Jani Nikula
Quoted 6 lines · Souptick Joarder
Quoted 2 lines · Sabyasachi Gupta

Replaced kmem_cache_alloc + memset with kmem_cache_zalloc

Put a new line gap in between these two lines and send v2.

Nah, the maintainers can trivially add the newline while applying. Review is much more valuable than nitpicking on the commit message.

Queued (and added newline).

thanks,
Gerd

maintainer
#4 lore raw
In reply to Jani Nikula
Quoted 11 lines · Jani Nikula
Quoted 6 lines · Souptick Joarder
Quoted 2 lines · Sabyasachi Gupta

Replaced kmem_cache_alloc + memset with kmem_cache_zalloc

Put a new line gap in between these two lines and send v2.

Nah, the maintainers can trivially add the newline while applying. Review is much more valuable than nitpicking on the commit message.

Queued (and added newline).

thanks,
Gerd

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reviewed-by
#5 lore raw
In reply to Souptick Joarder
Quoted 6 lines · Souptick Joarder
Quoted 2 lines · Sabyasachi Gupta

Replaced kmem_cache_alloc + memset with kmem_cache_zalloc

Put a new line gap in between these two lines and send v2.

Nah, the maintainers can trivially add the newline while applying. Review is much more valuable than nitpicking on the commit message.

Quoted 29 lines
Quoted 23 lines
---
 drivers/gpu/drm/virtio/virtgpu_vq.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/virtio/virtgpu_vq.c +1 -3
index 020070d..e001b79 100644
@@ -98,10 +98,9 @@ virtio_gpu_get_vbuf(struct virtio_gpu_device *vgdev,
 {
        struct virtio_gpu_vbuffer *vbuf;
 
-       vbuf = kmem_cache_alloc(vgdev->vbufs, GFP_KERNEL);
+       vbuf = kmem_cache_zalloc(vgdev->vbufs, GFP_KERNEL);
        if (!vbuf)
                return ERR_PTR(-ENOMEM);
-       memset(vbuf, 0, VBUFFER_SIZE);
 
        BUG_ON(size > MAX_INLINE_CMD_SIZE);
        vbuf->buf = (void *)vbuf + sizeof(*vbuf);
--
Quoted 2 lines

2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center