2018-10-19 16:01:32

by Sabyasachi Gupta

[permalink] [raw]
Subject: [PATCH] gpu/drm/virtio/virtgpu_vq.c: Use kmem_cache_zalloc

Replaced kmem_cache_alloc + memset with kmem_cache_zalloc
Signed-off-by: Sabyasachi Gupta <[email protected]>
---
drivers/gpu/drm/virtio/virtgpu_vq.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c
index 020070d..e001b79 100644
--- a/drivers/gpu/drm/virtio/virtgpu_vq.c
+++ b/drivers/gpu/drm/virtio/virtgpu_vq.c
@@ -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



2018-10-23 04:04:36

by Souptick Joarder

[permalink] [raw]
Subject: Re: [PATCH] gpu/drm/virtio/virtgpu_vq.c: Use kmem_cache_zalloc

On Fri, Oct 19, 2018 at 9:30 PM Sabyasachi Gupta
<[email protected]> wrote:
>
> Replaced kmem_cache_alloc + memset with kmem_cache_zalloc

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

> Signed-off-by: Sabyasachi Gupta <[email protected]>
> ---
> drivers/gpu/drm/virtio/virtgpu_vq.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c
> index 020070d..e001b79 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_vq.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_vq.c
> @@ -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
>

2018-10-23 09:51:55

by Jani Nikula

[permalink] [raw]
Subject: Re: [PATCH] gpu/drm/virtio/virtgpu_vq.c: Use kmem_cache_zalloc

On Tue, 23 Oct 2018, Souptick Joarder <[email protected]> wrote:
> On Fri, Oct 19, 2018 at 9:30 PM Sabyasachi Gupta
> <[email protected]> wrote:
>>
>> 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.

Reviewed-by: Jani Nikula <[email protected]>

>
>> Signed-off-by: Sabyasachi Gupta <[email protected]>
>> ---
>> drivers/gpu/drm/virtio/virtgpu_vq.c | 3 +--
>> 1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c
>> index 020070d..e001b79 100644
>> --- a/drivers/gpu/drm/virtio/virtgpu_vq.c
>> +++ b/drivers/gpu/drm/virtio/virtgpu_vq.c
>> @@ -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
>>
> _______________________________________________
> dri-devel mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

--
Jani Nikula, Intel Open Source Graphics Center

2018-10-30 05:37:20

by Gerd Hoffmann

[permalink] [raw]
Subject: Re: [PATCH] gpu/drm/virtio/virtgpu_vq.c: Use kmem_cache_zalloc

On Tue, Oct 23, 2018 at 12:50:36PM +0300, Jani Nikula wrote:
> On Tue, 23 Oct 2018, Souptick Joarder <[email protected]> wrote:
> > On Fri, Oct 19, 2018 at 9:30 PM Sabyasachi Gupta
> > <[email protected]> wrote:
> >>
> >> 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