Commit 754da569 authored by Enrico Scholz's avatar Enrico Scholz

media:mx6s_capture: fixed error path in start_streaming()

|  ------------[ cut here ]------------
|  WARNING: CPU: 0 PID: 2187 at drivers/media/v4l2-core/videobuf2-core.c:1347 vb2_start_streaming+0xe0/0x168 [videobuf2_core]
|  PC is at vb2_start_streaming+0xe0/0x168 [videobuf2_core]
|  LR is at vb2_start_streaming+0x6c/0x168 [videobuf2_core]
Signed-off-by: Enrico Scholz's avatarEnrico Scholz <enrico.scholz@sigma-chemnitz.de>
parent d40577c7
......@@ -996,6 +996,18 @@ static int mx6s_configure_csi(struct mx6s_csi_dev *csi_dev)
return 0;
}
static void mx6s_release_bufs(struct list_head *bufs,
enum vb2_buffer_state state)
{
while (!list_empty(bufs)) {
struct mx6s_buffer *buf =
list_first_entry(bufs, struct mx6s_buffer, internal.queue);
list_del_init(&buf->internal.queue);
vb2_buffer_done(&buf->vb.vb2_buf, state);
}
}
static int mx6s_start_streaming(struct vb2_queue *vq, unsigned int count)
{
struct mx6s_csi_dev *csi_dev = vb2_get_drv_priv(vq);
......@@ -1003,6 +1015,7 @@ static int mx6s_start_streaming(struct vb2_queue *vq, unsigned int count)
struct mx6s_buffer *buf;
unsigned long phys;
unsigned long flags;
int rc;
if (count < 2)
return -ENOBUFS;
......@@ -1059,7 +1072,22 @@ static int mx6s_start_streaming(struct vb2_queue *vq, unsigned int count)
spin_unlock_irqrestore(&csi_dev->slock, flags);
return mx6s_csi_enable(csi_dev);
rc = mx6s_csi_enable(csi_dev);
if (rc < 0) {
spin_lock_irqsave(&csi_dev->slock, flags);
mx6s_release_bufs(&csi_dev->active_bufs, VB2_BUF_STATE_QUEUED);
mx6s_release_bufs(&csi_dev->capture, VB2_BUF_STATE_QUEUED);
spin_unlock_irqrestore(&csi_dev->slock, flags);
goto out;
}
rc = 0;
out:
return rc;
}
static void mx6s_stop_streaming(struct vb2_queue *vq)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment