ChangeSet 1.1557.49.4, 2004/02/17 16:10:36-08:00, [EMAIL PROTECTED]

[PATCH] USB: some stv680 fixes

- swapRGB is already initialized to 0
- change "swapRGB_on == 1" to match in-source documentation
- submit urb with GFP_ATOMIC (interrupt context) - this made driver
   unusable because of "might_sleep" messages.
- group some "case"s
- release vdev on fail
- remove "kfree(0)" checking


 drivers/usb/media/stv680.c |   16 ++++++----------
 1 files changed, 6 insertions(+), 10 deletions(-)


diff -Nru a/drivers/usb/media/stv680.c b/drivers/usb/media/stv680.c
--- a/drivers/usb/media/stv680.c        Thu Feb 19 17:22:47 2004
+++ b/drivers/usb/media/stv680.c        Thu Feb 19 17:22:47 2004
@@ -490,10 +490,9 @@
        stv680->hue = 32767;
        stv680->palette = STV_VIDEO_PALETTE;
        stv680->depth = 24;     /* rgb24 bits */
-       swapRGB = 0;
        if ((swapRGB_on == 0) && (swapRGB == 0))
                PDEBUG (1, "STV(i): swapRGB is (auto) OFF");
-       else if ((swapRGB_on == 1) && (swapRGB == 1))
+       else if ((swapRGB_on == 0) && (swapRGB == 1))
                PDEBUG (1, "STV(i): swapRGB is (auto) ON");
        else if (swapRGB_on == 1)
                PDEBUG (1, "STV(i): swapRGB is (forced) ON");
@@ -657,7 +656,7 @@
        /* Resubmit urb for new data */
        urb->status = 0;
        urb->dev = stv680->udev;
-       if (usb_submit_urb (urb, GFP_KERNEL))
+       if (usb_submit_urb (urb, GFP_ATOMIC))
                PDEBUG (0, "STV(e): urb burned down in video irq");
        return;
 }                              /*  _video_irq  */
@@ -1252,13 +1251,10 @@
                        return -EINVAL;
                }
        case VIDIOCSFBUF:
-               return -EINVAL;
        case VIDIOCGTUNER:
        case VIDIOCSTUNER:
-               return -EINVAL;
        case VIDIOCGFREQ:
        case VIDIOCSFREQ:
-               return -EINVAL;
        case VIDIOCGAUDIO:
        case VIDIOCSAUDIO:
                return -EINVAL;
@@ -1434,7 +1430,7 @@
        if (video_register_device (stv680->vdev, VFL_TYPE_GRABBER, video_nr) == -1) {
                PDEBUG (0, "STV(e): video_register_device failed");
                retval = -EIO;
-               goto error;
+               goto error_vdev;
        }
        PDEBUG (0, "STV(i): registered new video device: video%d", 
stv680->vdev->minor);
 
@@ -1442,6 +1438,8 @@
        stv680_create_sysfs_files(stv680->vdev);
        return 0;
 
+error_vdev:
+       video_device_release(stv680->vdev);
 error:
        kfree(stv680);
        return retval;
@@ -1466,9 +1464,7 @@
                        kfree (stv680->sbuf[i].data);
                }
        for (i = 0; i < STV680_NUMSCRATCH; i++)
-               if (stv680->scratch[i].data) {
-                       kfree (stv680->scratch[i].data);
-               }
+               kfree (stv680->scratch[i].data);
        PDEBUG (0, "STV(i): %s disconnected", stv680->camera_name);
 
        /* Free the memory */



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id56&alloc_id438&op=click
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to