2019-07-25 05:52:55

by Hariprasad Kelam

[permalink] [raw]
Subject: [PATCH] staging: media: hantro: Remove call to memset after dma_alloc_coherent

fix below issue reported by coccicheck
/drivers/staging/media/hantro/hantro_vp8.c:149:16-34: WARNING:
dma_alloc_coherent use in aux_buf -> cpu already zeroes out memory, so
memset is not needed

Signed-off-by: Hariprasad Kelam <[email protected]>
---
drivers/staging/media/hantro/hantro_vp8.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/drivers/staging/media/hantro/hantro_vp8.c b/drivers/staging/media/hantro/hantro_vp8.c
index 66c4533..363ddda 100644
--- a/drivers/staging/media/hantro/hantro_vp8.c
+++ b/drivers/staging/media/hantro/hantro_vp8.c
@@ -151,8 +151,6 @@ int hantro_vp8_dec_init(struct hantro_ctx *ctx)
if (!aux_buf->cpu)
return -ENOMEM;

- memset(aux_buf->cpu, 0, aux_buf->size);
-
/*
* Allocate probability table buffer,
* total 1208 bytes, 4K page is far enough.
--
2.7.4


2019-07-25 17:00:42

by Boris Brezillon

[permalink] [raw]
Subject: Re: [PATCH] staging: media: hantro: Remove call to memset after dma_alloc_coherent

On Thu, 25 Jul 2019 08:36:02 +0530
Hariprasad Kelam <[email protected]> wrote:

> fix below issue reported by coccicheck
> /drivers/staging/media/hantro/hantro_vp8.c:149:16-34: WARNING:
> dma_alloc_coherent use in aux_buf -> cpu already zeroes out memory, so
> memset is not needed
>
> Signed-off-by: Hariprasad Kelam <[email protected]>

Reviewed-by: Boris Brezillon <[email protected]>

> ---
> drivers/staging/media/hantro/hantro_vp8.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/staging/media/hantro/hantro_vp8.c b/drivers/staging/media/hantro/hantro_vp8.c
> index 66c4533..363ddda 100644
> --- a/drivers/staging/media/hantro/hantro_vp8.c
> +++ b/drivers/staging/media/hantro/hantro_vp8.c
> @@ -151,8 +151,6 @@ int hantro_vp8_dec_init(struct hantro_ctx *ctx)
> if (!aux_buf->cpu)
> return -ENOMEM;
>
> - memset(aux_buf->cpu, 0, aux_buf->size);
> -
> /*
> * Allocate probability table buffer,
> * total 1208 bytes, 4K page is far enough.


2019-08-19 04:18:22

by Tomasz Figa

[permalink] [raw]
Subject: Re: [PATCH] staging: media: hantro: Remove call to memset after dma_alloc_coherent

Hi Hans,

On Thu, Jul 25, 2019 at 8:50 PM Boris Brezillon
<[email protected]> wrote:
>
> On Thu, 25 Jul 2019 08:36:02 +0530
> Hariprasad Kelam <[email protected]> wrote:
>
> > fix below issue reported by coccicheck
> > /drivers/staging/media/hantro/hantro_vp8.c:149:16-34: WARNING:
> > dma_alloc_coherent use in aux_buf -> cpu already zeroes out memory, so
> > memset is not needed
> >
> > Signed-off-by: Hariprasad Kelam <[email protected]>
>
> Reviewed-by: Boris Brezillon <[email protected]>
>
> > ---
> > drivers/staging/media/hantro/hantro_vp8.c | 2 --
> > 1 file changed, 2 deletions(-)
> >
> > diff --git a/drivers/staging/media/hantro/hantro_vp8.c b/drivers/staging/media/hantro/hantro_vp8.c
> > index 66c4533..363ddda 100644
> > --- a/drivers/staging/media/hantro/hantro_vp8.c
> > +++ b/drivers/staging/media/hantro/hantro_vp8.c
> > @@ -151,8 +151,6 @@ int hantro_vp8_dec_init(struct hantro_ctx *ctx)
> > if (!aux_buf->cpu)
> > return -ENOMEM;
> >
> > - memset(aux_buf->cpu, 0, aux_buf->size);
> > -
> > /*
> > * Allocate probability table buffer,
> > * total 1208 bytes, 4K page is far enough.
>

Is this something you will pick to your tree?

Best regards,
Tomasz

2019-08-19 04:20:47

by Tomasz Figa

[permalink] [raw]
Subject: Re: [PATCH] staging: media: hantro: Remove call to memset after dma_alloc_coherent

On Mon, Aug 19, 2019 at 1:17 PM Tomasz Figa <[email protected]> wrote:
>
> Hi Hans,
>
> On Thu, Jul 25, 2019 at 8:50 PM Boris Brezillon
> <[email protected]> wrote:
> >
> > On Thu, 25 Jul 2019 08:36:02 +0530
> > Hariprasad Kelam <[email protected]> wrote:
> >
> > > fix below issue reported by coccicheck
> > > /drivers/staging/media/hantro/hantro_vp8.c:149:16-34: WARNING:
> > > dma_alloc_coherent use in aux_buf -> cpu already zeroes out memory, so
> > > memset is not needed
> > >
> > > Signed-off-by: Hariprasad Kelam <[email protected]>
> >
> > Reviewed-by: Boris Brezillon <[email protected]>
> >
> > > ---
> > > drivers/staging/media/hantro/hantro_vp8.c | 2 --
> > > 1 file changed, 2 deletions(-)
> > >
> > > diff --git a/drivers/staging/media/hantro/hantro_vp8.c b/drivers/staging/media/hantro/hantro_vp8.c
> > > index 66c4533..363ddda 100644
> > > --- a/drivers/staging/media/hantro/hantro_vp8.c
> > > +++ b/drivers/staging/media/hantro/hantro_vp8.c
> > > @@ -151,8 +151,6 @@ int hantro_vp8_dec_init(struct hantro_ctx *ctx)
> > > if (!aux_buf->cpu)
> > > return -ENOMEM;
> > >
> > > - memset(aux_buf->cpu, 0, aux_buf->size);
> > > -
> > > /*
> > > * Allocate probability table buffer,
> > > * total 1208 bytes, 4K page is far enough.
> >
>
> Is this something you will pick to your tree?

Ah, sorry, this is already applied. Not sure why searching for it the
first time didn't show anything. I guess I need to start repeating my
searches by default. Sorry for the noise.

Best regards,
Tomasz