summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorEzequiel GarcĂ­a <elezegarcia@gmail.com>2012-07-26 07:59:04 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-07-30 21:11:35 -0300
commit8f695d3f07bf9fd2914d18d1d2f89e3574b809ff (patch)
treee512d4121aec36ca50392601fb35d26698bca041 /drivers
parentcd779254f92f30cef8d43d0c4345cfeebfc94db8 (diff)
[media] v4l2-dev.c: Move video_put() after debug printk
It is possible that video_put() releases video_device struct, provoking a panic when debug printk wants to get video_device node name. Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/v4l2-dev.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c
index 625248585c85..07aeafca9eaa 100644
--- a/drivers/media/video/v4l2-dev.c
+++ b/drivers/media/video/v4l2-dev.c
@@ -478,12 +478,12 @@ static int v4l2_open(struct inode *inode, struct file *filp)
}
err:
- /* decrease the refcount in case of an error */
- if (ret)
- video_put(vdev);
if (vdev->debug)
printk(KERN_DEBUG "%s: open (%d)\n",
video_device_node_name(vdev), ret);
+ /* decrease the refcount in case of an error */
+ if (ret)
+ video_put(vdev);
return ret;
}
@@ -500,12 +500,12 @@ static int v4l2_release(struct inode *inode, struct file *filp)
if (test_bit(V4L2_FL_LOCK_ALL_FOPS, &vdev->flags))
mutex_unlock(vdev->lock);
}
- /* decrease the refcount unconditionally since the release()
- return value is ignored. */
- video_put(vdev);
if (vdev->debug)
printk(KERN_DEBUG "%s: release\n",
video_device_node_name(vdev));
+ /* decrease the refcount unconditionally since the release()
+ return value is ignored. */
+ video_put(vdev);
return ret;
}