]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/media/video/v4l1-compat.c
Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzi...
[linux-2.6-omap-h63xx.git] / drivers / media / video / v4l1-compat.c
index ede8543818bfdfef8bdb3fa0bb86c0869cbf637a..50e1ff9f2be59181c9a67c8d642317870aac36cd 100644 (file)
@@ -19,7 +19,6 @@
 
 #include <linux/init.h>
 #include <linux/module.h>
-#include <linux/moduleparam.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
@@ -145,7 +144,7 @@ const static unsigned int palette2pixelformat[] = {
        [VIDEO_PALETTE_YUV422P] = V4L2_PIX_FMT_YUV422P,
 };
 
-static unsigned int __attribute_pure__
+static unsigned int __pure
 palette_to_pixelformat(unsigned int palette)
 {
        if (palette < ARRAY_SIZE(palette2pixelformat))
@@ -304,7 +303,11 @@ v4l_compat_translate_ioctl(struct inode         *inode,
        {
                struct video_capability *cap = arg;
 
-               cap2 = kzalloc(sizeof(*cap2),GFP_KERNEL);
+               cap2 = kzalloc(sizeof(*cap2), GFP_KERNEL);
+               if (!cap2) {
+                       err = -ENOMEM;
+                       break;
+               }
                memset(cap, 0, sizeof(*cap));
                memset(&fbuf2, 0, sizeof(fbuf2));
 
@@ -427,7 +430,11 @@ v4l_compat_translate_ioctl(struct inode         *inode,
        {
                struct video_window     *win = arg;
 
-               fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL);
+               fmt2 = kzalloc(sizeof(*fmt2), GFP_KERNEL);
+               if (!fmt2) {
+                       err = -ENOMEM;
+                       break;
+               }
                memset(win,0,sizeof(*win));
 
                fmt2->type = V4L2_BUF_TYPE_VIDEO_OVERLAY;
@@ -465,7 +472,11 @@ v4l_compat_translate_ioctl(struct inode         *inode,
                struct video_window     *win = arg;
                int err1,err2;
 
-               fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL);
+               fmt2 = kzalloc(sizeof(*fmt2), GFP_KERNEL);
+               if (!fmt2) {
+                       err = -ENOMEM;
+                       break;
+               }
                fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
                drv(inode, file, VIDIOC_STREAMOFF, &fmt2->type);
                err1 = drv(inode, file, VIDIOC_G_FMT, fmt2);
@@ -587,6 +598,12 @@ v4l_compat_translate_ioctl(struct inode         *inode,
        {
                struct video_picture    *pict = arg;
 
+               fmt2 = kzalloc(sizeof(*fmt2), GFP_KERNEL);
+               if (!fmt2) {
+                       err = -ENOMEM;
+                       break;
+               }
+
                pict->brightness = get_v4l_control(inode, file,
                                                   V4L2_CID_BRIGHTNESS,drv);
                pict->hue = get_v4l_control(inode, file,
@@ -598,7 +615,6 @@ v4l_compat_translate_ioctl(struct inode         *inode,
                pict->whiteness = get_v4l_control(inode, file,
                                                  V4L2_CID_WHITENESS, drv);
 
-               fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL);
                fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
                err = drv(inode, file, VIDIOC_G_FMT, fmt2);
                if (err < 0) {
@@ -618,6 +634,11 @@ v4l_compat_translate_ioctl(struct inode         *inode,
                struct video_picture    *pict = arg;
                int mem_err = 0, ovl_err = 0;
 
+               fmt2 = kzalloc(sizeof(*fmt2), GFP_KERNEL);
+               if (!fmt2) {
+                       err = -ENOMEM;
+                       break;
+               }
                memset(&fbuf2, 0, sizeof(fbuf2));
 
                set_v4l_control(inode, file,
@@ -637,7 +658,6 @@ v4l_compat_translate_ioctl(struct inode         *inode,
                 * different pixel formats for memory vs overlay.
                 */
 
-               fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL);
                fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
                err = drv(inode, file, VIDIOC_G_FMT, fmt2);
                /* If VIDIOC_G_FMT failed, then the driver likely doesn't
@@ -891,7 +911,11 @@ v4l_compat_translate_ioctl(struct inode         *inode,
        {
                struct video_mmap       *mm = arg;
 
-               fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL);
+               fmt2 = kzalloc(sizeof(*fmt2), GFP_KERNEL);
+               if (!fmt2) {
+                       err = -ENOMEM;
+                       break;
+               }
                memset(&buf2,0,sizeof(buf2));
 
                fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
@@ -987,7 +1011,11 @@ v4l_compat_translate_ioctl(struct inode         *inode,
        {
                struct vbi_format      *fmt = arg;
 
-               fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL);
+               fmt2 = kzalloc(sizeof(*fmt2), GFP_KERNEL);
+               if (!fmt2) {
+                       err = -ENOMEM;
+                       break;
+               }
                fmt2->type = V4L2_BUF_TYPE_VBI_CAPTURE;
 
                err = drv(inode, file, VIDIOC_G_FMT, fmt2);
@@ -1019,8 +1047,11 @@ v4l_compat_translate_ioctl(struct inode         *inode,
                        break;
                }
 
-               fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL);
-
+               fmt2 = kzalloc(sizeof(*fmt2), GFP_KERNEL);
+               if (!fmt2) {
+                       err = -ENOMEM;
+                       break;
+               }
                fmt2->type = V4L2_BUF_TYPE_VBI_CAPTURE;
                fmt2->fmt.vbi.samples_per_line = fmt->samples_per_line;
                fmt2->fmt.vbi.sampling_rate    = fmt->sampling_rate;