Re: [PATCH] media: mx3_camera: buf_init() add buffer state check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Alex

On Mon, 30 Jul 2012, Alex Gershgorin wrote:

> This patch check the state of the buffer when calling buf_init() method.
> The thread http://thread.gmane.org/gmane.linux.drivers.video-input-infrastructure/48587
> also includes report witch can show the problem. This patch solved the problem.
> Both MMAP and USERPTR methods was successfully tested.
> 
> Signed-off-by: Alex Gershgorin <alexg@xxxxxxxxxxxxxx>
> ---
>  drivers/media/video/mx3_camera.c |   12 +++++++-----
>  1 files changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/media/video/mx3_camera.c b/drivers/media/video/mx3_camera.c
> index f13643d..950a8fe 100644
> --- a/drivers/media/video/mx3_camera.c
> +++ b/drivers/media/video/mx3_camera.c
> @@ -405,13 +405,15 @@ static int mx3_videobuf_init(struct vb2_buffer *vb)

Sorry, don't understand. As we see in the thread, mentioned above, the 
Oops happened in mx3_videobuf_release(). If my analysis was correct in 
that thread, that Oops happened, when .buf_cleanup() was called without 
.buf_init() being called. This your patch modifies mx3_videobuf_init(). 
which isn't even called in the problem case. How does this help?

Thanks
Guennadi

>  	struct mx3_camera_dev *mx3_cam = ici->priv;
>  	struct mx3_camera_buffer *buf = to_mx3_vb(vb);
>  
> -	/* This is for locking debugging only */
> -	INIT_LIST_HEAD(&buf->queue);
> -	sg_init_table(&buf->sg, 1);
> +	if (buf->state != CSI_BUF_PREPARED) {
> +		/* This is for locking debugging only */
> +		INIT_LIST_HEAD(&buf->queue);
> +		sg_init_table(&buf->sg, 1);
>  
> -	buf->state = CSI_BUF_NEEDS_INIT;
> +		buf->state = CSI_BUF_NEEDS_INIT;
>  
> -	mx3_cam->buf_total += vb2_plane_size(vb, 0);
> +		mx3_cam->buf_total += vb2_plane_size(vb, 0);
> +	}
>  
>  	return 0;
>  }
> -- 
> 1.7.0.4
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux