Commit 7e47c384 authored by Philipp Zabel's avatar Philipp Zabel Committed by Mauro Carvalho Chehab
Browse files

media: coda: fail S_SELECTION for read-only targets



v4l2-compliance complains if S_SELECTION returns 0 for read-only targets.

Signed-off-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: default avatarHans Verkuil <hansverk@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent cf13135c
Loading
Loading
Loading
Loading
+29 −22
Original line number Diff line number Diff line
@@ -939,9 +939,10 @@ static int coda_s_selection(struct file *file, void *fh,
	struct coda_ctx *ctx = fh_to_ctx(fh);
	struct coda_q_data *q_data;

	switch (s->target) {
	case V4L2_SEL_TGT_CROP:
		if (ctx->inst_type == CODA_INST_ENCODER &&
	    s->type == V4L2_BUF_TYPE_VIDEO_OUTPUT &&
	    s->target == V4L2_SEL_TGT_CROP) {
		    s->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) {
			q_data = get_q_data(ctx, s->type);
			if (!q_data)
				return -EINVAL;
@@ -963,8 +964,14 @@ static int coda_s_selection(struct file *file, void *fh,

			return 0;
		}

		/* else fall through */
	case V4L2_SEL_TGT_NATIVE_SIZE:
	case V4L2_SEL_TGT_COMPOSE:
		return coda_g_selection(file, fh, s);
	default:
		/* v4l2-compliance expects this to fail for read-only targets */
		return -EINVAL;
	}
}

static int coda_try_encoder_cmd(struct file *file, void *fh,