Merge branches 'msm-fixes' and 'msm-video' of git://codeaurora.org/quic/kernel/dwalke...
[pandora-kernel.git] / drivers / media / video / v4l1-compat.c
index 0c2105c..d4ac751 100644 (file)
@@ -645,9 +645,16 @@ static noinline long v4l1_compat_get_picture(
                goto done;
        }
 
-       pict->depth   = ((fmt->fmt.pix.bytesperline << 3)
-                        + (fmt->fmt.pix.width - 1))
-                        / fmt->fmt.pix.width;
+       if (fmt->fmt.pix.width)
+       {
+               pict->depth   = ((fmt->fmt.pix.bytesperline << 3)
+                                + (fmt->fmt.pix.width - 1))
+                                / fmt->fmt.pix.width;
+       } else {
+               err = -EINVAL;
+               goto done;
+       }
+
        pict->palette = pixelformat_to_palette(
                fmt->fmt.pix.pixelformat);
 done: