From: Hans Verkuil <hverkuil@xs4all.nl>
To: achew@nvidia.com
Cc: zhangtianfei@leadcoretech.com, pawel@osciak.com,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] videobuf: Initialize lists in videobuf_buffer.
Date: Wed, 17 Nov 2010 08:13:43 +0100 [thread overview]
Message-ID: <201011170813.43236.hverkuil@xs4all.nl> (raw)
In-Reply-To: <1289939083-27209-1-git-send-email-achew@nvidia.com>
On Tuesday, November 16, 2010 21:24:43 achew@nvidia.com wrote:
> From: Andrew Chew <achew@nvidia.com>
>
> There are two struct list_head's in struct videobuf_buffer.
> Prior to this fix, all we did for initialization of struct videobuf_buffer
> was to zero out its memory. This does not properly initialize this struct's
> two list_head members.
>
> This patch immediately calls INIT_LIST_HEAD on both lists after the kzalloc,
> so that the two lists are initialized properly.
Rather than doing this for all videobuf variants I would suggest that you
do this in videobuf-core.c, videobuf_alloc_vb().
Regards,
Hans
>
> Signed-off-by: Andrew Chew <achew@nvidia.com>
> ---
> I thought I'd submit a patch for this anyway. Without this, the existing
> camera host drivers will spew an ugly warning on every videobuf allocation,
> which gets annoying really fast.
>
> drivers/media/video/videobuf-dma-contig.c | 2 ++
> drivers/media/video/videobuf-dma-sg.c | 2 ++
> drivers/media/video/videobuf-vmalloc.c | 2 ++
> 3 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/media/video/videobuf-dma-contig.c b/drivers/media/video/videobuf-dma-contig.c
> index c969111..f7e0f86 100644
> --- a/drivers/media/video/videobuf-dma-contig.c
> +++ b/drivers/media/video/videobuf-dma-contig.c
> @@ -193,6 +193,8 @@ static struct videobuf_buffer *__videobuf_alloc_vb(size_t size)
> if (vb) {
> mem = vb->priv = ((char *)vb) + size;
> mem->magic = MAGIC_DC_MEM;
> + INIT_LIST_HEAD(&vb->stream);
> + INIT_LIST_HEAD(&vb->queue);
> }
>
> return vb;
> diff --git a/drivers/media/video/videobuf-dma-sg.c b/drivers/media/video/videobuf-dma-sg.c
> index 20f227e..5af3217 100644
> --- a/drivers/media/video/videobuf-dma-sg.c
> +++ b/drivers/media/video/videobuf-dma-sg.c
> @@ -430,6 +430,8 @@ static struct videobuf_buffer *__videobuf_alloc_vb(size_t size)
>
> mem = vb->priv = ((char *)vb) + size;
> mem->magic = MAGIC_SG_MEM;
> + INIT_LIST_HEAD(&vb->stream);
> + INIT_LIST_HEAD(&vb->queue);
>
> videobuf_dma_init(&mem->dma);
>
> diff --git a/drivers/media/video/videobuf-vmalloc.c b/drivers/media/video/videobuf-vmalloc.c
> index df14258..8babedd 100644
> --- a/drivers/media/video/videobuf-vmalloc.c
> +++ b/drivers/media/video/videobuf-vmalloc.c
> @@ -146,6 +146,8 @@ static struct videobuf_buffer *__videobuf_alloc_vb(size_t size)
>
> mem = vb->priv = ((char *)vb) + size;
> mem->magic = MAGIC_VMAL_MEM;
> + INIT_LIST_HEAD(&vb->stream);
> + INIT_LIST_HEAD(&vb->queue);
>
> dprintk(1, "%s: allocated at %p(%ld+%ld) & %p(%ld)\n",
> __func__, vb, (long)sizeof(*vb), (long)size - sizeof(*vb),
>
--
Hans Verkuil - video4linux developer - sponsored by Cisco
prev parent reply other threads:[~2010-11-17 7:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-16 20:24 achew
2010-11-17 1:10 ` Figo.zhang
[not found] ` <643E69AA4436674C8F39DCC2C05F763816BB828A40@HQMAIL03.nvidia.com>
2010-11-17 1:39 ` Figo.zhang
2010-11-17 7:11 ` Hans Verkuil
2010-11-17 7:16 ` Figo.zhang
2010-11-17 7:52 ` Hans Verkuil
2010-11-17 12:37 ` Laurent Pinchart
2010-11-17 12:44 ` Hans Verkuil
2010-11-17 7:13 ` Hans Verkuil [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201011170813.43236.hverkuil@xs4all.nl \
--to=hverkuil@xs4all.nl \
--cc=achew@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=pawel@osciak.com \
--cc=zhangtianfei@leadcoretech.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®