Commit b9736299 authored by Philipp Zabel's avatar Philipp Zabel Committed by Mauro Carvalho Chehab

[media] coda: remove BUG() in get_q_data

This allows us to get rid of the now superfluous v4l2_m2m_get_vq check
in G_FMT. Also, we can use this to check the buffer type in G_SELECTION
later.
Signed-off-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: default avatarKamil Debski <k.debski@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent 89548441
...@@ -326,9 +326,8 @@ static struct coda_q_data *get_q_data(struct coda_ctx *ctx, ...@@ -326,9 +326,8 @@ static struct coda_q_data *get_q_data(struct coda_ctx *ctx,
case V4L2_BUF_TYPE_VIDEO_CAPTURE: case V4L2_BUF_TYPE_VIDEO_CAPTURE:
return &(ctx->q_data[V4L2_M2M_DST]); return &(ctx->q_data[V4L2_M2M_DST]);
default: default:
BUG(); return NULL;
} }
return NULL;
} }
/* /*
...@@ -571,15 +570,12 @@ static int coda_enum_fmt_vid_out(struct file *file, void *priv, ...@@ -571,15 +570,12 @@ static int coda_enum_fmt_vid_out(struct file *file, void *priv,
static int coda_g_fmt(struct file *file, void *priv, static int coda_g_fmt(struct file *file, void *priv,
struct v4l2_format *f) struct v4l2_format *f)
{ {
struct vb2_queue *vq;
struct coda_q_data *q_data; struct coda_q_data *q_data;
struct coda_ctx *ctx = fh_to_ctx(priv); struct coda_ctx *ctx = fh_to_ctx(priv);
vq = v4l2_m2m_get_vq(ctx->m2m_ctx, f->type);
if (!vq)
return -EINVAL;
q_data = get_q_data(ctx, f->type); q_data = get_q_data(ctx, f->type);
if (!q_data)
return -EINVAL;
f->fmt.pix.field = V4L2_FIELD_NONE; f->fmt.pix.field = V4L2_FIELD_NONE;
f->fmt.pix.pixelformat = q_data->fourcc; f->fmt.pix.pixelformat = q_data->fourcc;
...@@ -628,6 +624,8 @@ static int coda_try_fmt(struct coda_ctx *ctx, struct coda_codec *codec, ...@@ -628,6 +624,8 @@ static int coda_try_fmt(struct coda_ctx *ctx, struct coda_codec *codec,
break; break;
default: default:
q_data = get_q_data(ctx, f->type); q_data = get_q_data(ctx, f->type);
if (!q_data)
return -EINVAL;
f->fmt.pix.pixelformat = q_data->fourcc; f->fmt.pix.pixelformat = q_data->fourcc;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment