diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2010-05-02 07:01:04 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-05-19 11:58:57 -0400 |
commit | f2b305cd6711b7b3ce30db93b50bc5d6312950c8 (patch) | |
tree | fd70d24d94642f029024afd755e900b9264ff3b0 /drivers/media/video/hdpvr/hdpvr-video.c | |
parent | a2bdc5e6c4fefea6b0d576a4f610e47456647577 (diff) |
V4L/DVB: hdpvr: fix disconnect sequence
Disconnecting the HDPVR caused a kernel oops if lockdep was enabled.
In addition, if an app still had video0 open and attempted to call ioctl
when the device was already disconnected the system would crash.
Move the freeing and cleanup code to the release function: that is the
right place for it since you know when you get there that nobody is
using the device.
Also removed usb_set_intfdata: v4l2_device_register sets this already
to v4l2_dev.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/hdpvr/hdpvr-video.c')
-rw-r--r-- | drivers/media/video/hdpvr/hdpvr-video.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/media/video/hdpvr/hdpvr-video.c b/drivers/media/video/hdpvr/hdpvr-video.c index 196f82de48f0..d2f0ee29737f 100644 --- a/drivers/media/video/hdpvr/hdpvr-video.c +++ b/drivers/media/video/hdpvr/hdpvr-video.c | |||
@@ -1214,6 +1214,24 @@ static void hdpvr_device_release(struct video_device *vdev) | |||
1214 | struct hdpvr_device *dev = video_get_drvdata(vdev); | 1214 | struct hdpvr_device *dev = video_get_drvdata(vdev); |
1215 | 1215 | ||
1216 | hdpvr_delete(dev); | 1216 | hdpvr_delete(dev); |
1217 | mutex_lock(&dev->io_mutex); | ||
1218 | destroy_workqueue(dev->workqueue); | ||
1219 | mutex_unlock(&dev->io_mutex); | ||
1220 | |||
1221 | v4l2_device_unregister(&dev->v4l2_dev); | ||
1222 | |||
1223 | /* deregister I2C adapter */ | ||
1224 | #ifdef CONFIG_I2C | ||
1225 | mutex_lock(&dev->i2c_mutex); | ||
1226 | if (dev->i2c_adapter) | ||
1227 | i2c_del_adapter(dev->i2c_adapter); | ||
1228 | kfree(dev->i2c_adapter); | ||
1229 | dev->i2c_adapter = NULL; | ||
1230 | mutex_unlock(&dev->i2c_mutex); | ||
1231 | #endif /* CONFIG_I2C */ | ||
1232 | |||
1233 | kfree(dev->usbc_buf); | ||
1234 | kfree(dev); | ||
1217 | } | 1235 | } |
1218 | 1236 | ||
1219 | static const struct video_device hdpvr_video_template = { | 1237 | static const struct video_device hdpvr_video_template = { |