From: Hans Verkuil Date: Wed, 20 Jul 2016 12:31:25 +0000 (-0300) Subject: [media] vivid: return -ENODATA if the current input doesn't support g/s_selection X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0d0abef8d457c96dbb388cac5d3aec81650d8036;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git [media] vivid: return -ENODATA if the current input doesn't support g/s_selection Returning -EINVAL indicates wrong arguments, but that's not the case here. Returning -ENOTTY is also no option, since the ioctl is implemented, but it just is not valid for this input. So use -ENODATA instead. This is also used elsewhere when an ioctl isn't valid for a specific input. In this case G/S_SELECTION returned -EINVAL for the webcam input. That input doesn't support cropping, instead it uses ENUM_FRAMESIZES to enumerate a list of discrete frame sizes. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/platform/vivid/vivid-vid-cap.c b/drivers/media/platform/vivid/vivid-vid-cap.c index d404a7ce33a4..d5c84ecf2027 100644 --- a/drivers/media/platform/vivid/vivid-vid-cap.c +++ b/drivers/media/platform/vivid/vivid-vid-cap.c @@ -823,7 +823,7 @@ int vivid_vid_cap_g_selection(struct file *file, void *priv, if (sel->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; if (vivid_is_webcam(dev)) - return -EINVAL; + return -ENODATA; sel->r.left = sel->r.top = 0; switch (sel->target) { @@ -872,7 +872,7 @@ int vivid_vid_cap_s_selection(struct file *file, void *fh, struct v4l2_selection if (s->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; if (vivid_is_webcam(dev)) - return -EINVAL; + return -ENODATA; switch (s->target) { case V4L2_SEL_TGT_CROP: