aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/usbvideo
diff options
context:
space:
mode:
authorOliver Neukum <oneukum@suse.de>2007-03-09 16:05:43 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-04-27 14:44:22 -0400
commit5332bdbe9aae9e1a8fc5daaca6c75f05bc37d310 (patch)
treef4cf02af9c773b51ce05892fcd0ea976eab91e99 /drivers/media/video/usbvideo
parent5cdc178d1c7e677f0344b7b933d71c900ae73c85 (diff)
V4L/DVB (5399): Usbvideo module handling
Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/usbvideo')
-rw-r--r--drivers/media/video/usbvideo/usbvideo.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/drivers/media/video/usbvideo/usbvideo.c b/drivers/media/video/usbvideo/usbvideo.c
index d34d8c8b7376..687f026753b2 100644
--- a/drivers/media/video/usbvideo/usbvideo.c
+++ b/drivers/media/video/usbvideo/usbvideo.c
@@ -628,24 +628,21 @@ EXPORT_SYMBOL(usbvideo_HexDump);
628/* ******************************************************************** */ 628/* ******************************************************************** */
629 629
630/* XXX: this piece of crap really wants some error handling.. */ 630/* XXX: this piece of crap really wants some error handling.. */
631static void usbvideo_ClientIncModCount(struct uvd *uvd) 631static int usbvideo_ClientIncModCount(struct uvd *uvd)
632{ 632{
633 if (uvd == NULL) { 633 if (uvd == NULL) {
634 err("%s: uvd == NULL", __FUNCTION__); 634 err("%s: uvd == NULL", __FUNCTION__);
635 return; 635 return -EINVAL;
636 } 636 }
637 if (uvd->handle == NULL) { 637 if (uvd->handle == NULL) {
638 err("%s: uvd->handle == NULL", __FUNCTION__); 638 err("%s: uvd->handle == NULL", __FUNCTION__);
639 return; 639 return -EINVAL;
640 }
641 if (uvd->handle->md_module == NULL) {
642 err("%s: uvd->handle->md_module == NULL", __FUNCTION__);
643 return;
644 } 640 }
645 if (!try_module_get(uvd->handle->md_module)) { 641 if (!try_module_get(uvd->handle->md_module)) {
646 err("%s: try_module_get() == 0", __FUNCTION__); 642 err("%s: try_module_get() == 0", __FUNCTION__);
647 return; 643 return -ENODEV;
648 } 644 }
645 return 0;
649} 646}
650 647
651static void usbvideo_ClientDecModCount(struct uvd *uvd) 648static void usbvideo_ClientDecModCount(struct uvd *uvd)
@@ -712,8 +709,6 @@ int usbvideo_register(
712 cams->num_cameras = num_cams; 709 cams->num_cameras = num_cams;
713 cams->cam = (struct uvd *) &cams[1]; 710 cams->cam = (struct uvd *) &cams[1];
714 cams->md_module = md; 711 cams->md_module = md;
715 if (cams->md_module == NULL)
716 warn("%s: module == NULL!", __FUNCTION__);
717 mutex_init(&cams->lock); /* to 1 == available */ 712 mutex_init(&cams->lock); /* to 1 == available */
718 713
719 for (i = 0; i < num_cams; i++) { 714 for (i = 0; i < num_cams; i++) {
@@ -1119,7 +1114,8 @@ static int usbvideo_v4l_open(struct inode *inode, struct file *file)
1119 if (uvd->debug > 1) 1114 if (uvd->debug > 1)
1120 info("%s($%p)", __FUNCTION__, dev); 1115 info("%s($%p)", __FUNCTION__, dev);
1121 1116
1122 usbvideo_ClientIncModCount(uvd); 1117 if (0 < usbvideo_ClientIncModCount(uvd))
1118 return -ENODEV;
1123 mutex_lock(&uvd->lock); 1119 mutex_lock(&uvd->lock);
1124 1120
1125 if (uvd->user) { 1121 if (uvd->user) {