media: cropcap/g_selection split
[sfrench/cifs-2.6.git] / drivers / media / platform / am437x / am437x-vpfe.c
index e13d2b3a7168ff3897f2561dc33415c86f0e86d8..9b8a75355c5e8beb5a234a22de33c77243126870 100644 (file)
@@ -2091,13 +2091,6 @@ static int vpfe_cropcap(struct file *file, void *priv,
        if (vpfe->std_index >= ARRAY_SIZE(vpfe_standards))
                return -EINVAL;
 
-       memset(crop, 0, sizeof(struct v4l2_cropcap));
-
-       crop->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-       crop->defrect.width = vpfe_standards[vpfe->std_index].width;
-       crop->bounds.width = crop->defrect.width;
-       crop->defrect.height = vpfe_standards[vpfe->std_index].height;
-       crop->bounds.height = crop->defrect.height;
        crop->pixelaspect = vpfe_standards[vpfe->std_index].pixelaspect;
 
        return 0;
@@ -2108,12 +2101,17 @@ vpfe_g_selection(struct file *file, void *fh, struct v4l2_selection *s)
 {
        struct vpfe_device *vpfe = video_drvdata(file);
 
+       if (s->type != V4L2_BUF_TYPE_VIDEO_CAPTURE ||
+           vpfe->std_index >= ARRAY_SIZE(vpfe_standards))
+               return -EINVAL;
+
        switch (s->target) {
        case V4L2_SEL_TGT_CROP_BOUNDS:
        case V4L2_SEL_TGT_CROP_DEFAULT:
-               s->r.left = s->r.top = 0;
-               s->r.width = vpfe->crop.width;
-               s->r.height = vpfe->crop.height;
+               s->r.left = 0;
+               s->r.top = 0;
+               s->r.width = vpfe_standards[vpfe->std_index].width;
+               s->r.height = vpfe_standards[vpfe->std_index].height;
                break;
 
        case V4L2_SEL_TGT_CROP: