summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/usbvideo/usbvideo.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2007-03-09 19:05:43 -0200
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-03-09 19:05:43 -0200
commitb57241d11bd12a147c53051dcd943aef49f905f2 (patch)
tree264feb5c57485bfc0f5ddfa2721410a2d2231505 /linux/drivers/media/video/usbvideo/usbvideo.c
parentefffe5f20652aa0ba618b4a4180719bf468e4343 (diff)
downloadmediapointer-dvb-s2-b57241d11bd12a147c53051dcd943aef49f905f2.tar.gz
mediapointer-dvb-s2-b57241d11bd12a147c53051dcd943aef49f905f2.tar.bz2
Usbvideo module handling
From: Oliver Neukum <oneukum@suse.de> Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux/drivers/media/video/usbvideo/usbvideo.c')
-rw-r--r--linux/drivers/media/video/usbvideo/usbvideo.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/linux/drivers/media/video/usbvideo/usbvideo.c b/linux/drivers/media/video/usbvideo/usbvideo.c
index bf3482f98..ec47f3244 100644
--- a/linux/drivers/media/video/usbvideo/usbvideo.c
+++ b/linux/drivers/media/video/usbvideo/usbvideo.c
@@ -628,24 +628,21 @@ EXPORT_SYMBOL(usbvideo_HexDump);
/* ******************************************************************** */
/* XXX: this piece of crap really wants some error handling.. */
-static void usbvideo_ClientIncModCount(struct uvd *uvd)
+static int usbvideo_ClientIncModCount(struct uvd *uvd)
{
if (uvd == NULL) {
err("%s: uvd == NULL", __FUNCTION__);
- return;
+ return -EINVAL;
}
if (uvd->handle == NULL) {
err("%s: uvd->handle == NULL", __FUNCTION__);
- return;
- }
- if (uvd->handle->md_module == NULL) {
- err("%s: uvd->handle->md_module == NULL", __FUNCTION__);
- return;
+ return -EINVAL;
}
if (!try_module_get(uvd->handle->md_module)) {
err("%s: try_module_get() == 0", __FUNCTION__);
- return;
+ return -ENODEV;
}
+ return 0;
}
static void usbvideo_ClientDecModCount(struct uvd *uvd)
@@ -712,8 +709,6 @@ int usbvideo_register(
cams->num_cameras = num_cams;
cams->cam = (struct uvd *) &cams[1];
cams->md_module = md;
- if (cams->md_module == NULL)
- warn("%s: module == NULL!", __FUNCTION__);
mutex_init(&cams->lock); /* to 1 == available */
for (i = 0; i < num_cams; i++) {
@@ -1119,7 +1114,8 @@ static int usbvideo_v4l_open(struct inode *inode, struct file *file)
if (uvd->debug > 1)
info("%s($%p)", __FUNCTION__, dev);
- usbvideo_ClientIncModCount(uvd);
+ if (0 < usbvideo_ClientIncModCount(uvd))
+ return -ENODEV;
mutex_lock(&uvd->lock);
if (uvd->user) {