[media] coda: skip calling coda_find_codec in encoder try_fmt_vid_out
authorPhilipp Zabel <p.zabel@pengutronix.de>
Tue, 5 Aug 2014 17:00:12 +0000 (14:00 -0300)
committerMauro Carvalho Chehab <m.chehab@samsung.com>
Thu, 21 Aug 2014 20:25:24 +0000 (15:25 -0500)
We know that it will return NULL in this case, so we can just as well
skip it altogether.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
drivers/media/platform/coda/coda-common.c

index 6760e346f96995771901861bfefe6437d2194528..4e85e387f9052f5e2dcc26079c981b48275fcb6e 100644 (file)
@@ -426,14 +426,15 @@ static int coda_try_fmt_vid_out(struct file *file, void *priv,
                                struct v4l2_format *f)
 {
        struct coda_ctx *ctx = fh_to_ctx(priv);
-       const struct coda_codec *codec;
+       const struct coda_codec *codec = NULL;
 
        /* Determine codec by encoded format, returns NULL if raw or invalid */
-       codec = coda_find_codec(ctx->dev, f->fmt.pix.pixelformat,
-                               V4L2_PIX_FMT_YUV420);
-       if (!codec && ctx->inst_type == CODA_INST_DECODER) {
-               codec = coda_find_codec(ctx->dev, V4L2_PIX_FMT_H264,
+       if (ctx->inst_type == CODA_INST_DECODER) {
+               codec = coda_find_codec(ctx->dev, f->fmt.pix.pixelformat,
                                        V4L2_PIX_FMT_YUV420);
+               if (!codec)
+                       codec = coda_find_codec(ctx->dev, V4L2_PIX_FMT_H264,
+                                               V4L2_PIX_FMT_YUV420);
                if (!codec)
                        return -EINVAL;
        }