Here's the patch again against 2.4.5-pre5.

thanks,

greg k-h
diff -Nru a/drivers/usb/dc2xx.c b/drivers/usb/dc2xx.c
--- a/drivers/usb/dc2xx.c       Thu May 24 00:31:29 2001
+++ b/drivers/usb/dc2xx.c       Thu May 24 00:31:29 2001
@@ -336,8 +336,9 @@
        if (!camera->dev) {
                minor_data [subminor] = NULL;
                kfree (camera);
-       }
-       up (&camera->sem);
+       } else
+               up (&camera->sem);
+       
        up (&state_table_mutex);
 
        dbg ("close #%d", subminor); 
@@ -397,7 +398,6 @@
        }
        if (i >= MAX_CAMERAS) {
                info ("Ignoring additional USB Camera");
-               up (&state_table_mutex);
                goto bye;
        }
 
@@ -405,7 +405,6 @@
        camera = minor_data [i] = kmalloc (sizeof *camera, GFP_KERNEL);
        if (!camera) {
                err ("no memory!");
-               up (&state_table_mutex);
                goto bye;
        }
 
@@ -472,13 +471,15 @@
        if (!camera->buf) {
                minor_data [subminor] = NULL;
                kfree (camera);
+               camera = NULL;
        } else
                camera->dev = NULL;
 
        info ("USB Camera #%d disconnected", subminor);
        usb_dec_dev_use (dev);
 
-       up (&camera->sem);
+       if (camera != NULL)
+               up (&camera->sem);
        up (&state_table_mutex);
 }
 

Reply via email to