summaryrefslogtreecommitdiffstats
path: root/drivers/media/usb/stk1160
diff options
context:
space:
mode:
authorEzequiel Garcia2012-08-20 02:23:46 +0200
committerMauro Carvalho Chehab2012-09-25 15:56:48 +0200
commit8ac456495a33d9466076fea94594181ceefb76d9 (patch)
treed452d0c40004d1eaee6b34a0838fc8932eda2997 /drivers/media/usb/stk1160
parent[media] stk1160: Fix s_fmt and try_fmt implementation (diff)
downloadkernel-qcow2-linux-8ac456495a33d9466076fea94594181ceefb76d9.tar.gz
kernel-qcow2-linux-8ac456495a33d9466076fea94594181ceefb76d9.tar.xz
kernel-qcow2-linux-8ac456495a33d9466076fea94594181ceefb76d9.zip
[media] stk1160: Stop device and unqueue buffers when start_streaming() fails
If start_streaming() fails (e.g. out of memory) the driver needs to rewind the start procedure. This implies possibly stopping the device and clearing the buffer queue. Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/usb/stk1160')
-rw-r--r--drivers/media/usb/stk1160/stk1160-v4l.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/media/usb/stk1160/stk1160-v4l.c b/drivers/media/usb/stk1160/stk1160-v4l.c
index 879800dd162f..fe6e857969ca 100644
--- a/drivers/media/usb/stk1160/stk1160-v4l.c
+++ b/drivers/media/usb/stk1160/stk1160-v4l.c
@@ -184,7 +184,7 @@ static int stk1160_start_streaming(struct stk1160 *dev)
if (!dev->isoc_ctl.num_bufs || new_pkt_size) {
rc = stk1160_alloc_isoc(dev);
if (rc < 0)
- goto out_unlock;
+ goto out_stop_hw;
}
/* submit urbs and enables IRQ */
@@ -192,8 +192,7 @@ static int stk1160_start_streaming(struct stk1160 *dev)
rc = usb_submit_urb(dev->isoc_ctl.urb[i], GFP_KERNEL);
if (rc) {
stk1160_err("cannot submit urb[%d] (%d)\n", i, rc);
- stk1160_uninit_isoc(dev);
- goto out_unlock;
+ goto out_uninit;
}
}
@@ -206,7 +205,16 @@ static int stk1160_start_streaming(struct stk1160 *dev)
stk1160_dbg("streaming started\n");
-out_unlock:
+ mutex_unlock(&dev->v4l_lock);
+
+ return 0;
+
+out_uninit:
+ stk1160_uninit_isoc(dev);
+out_stop_hw:
+ usb_set_interface(dev->udev, 0, 0);
+ stk1160_clear_queue(dev);
+
mutex_unlock(&dev->v4l_lock);
return rc;