Commit fa3cb90b authored by Tony K Nadackal's avatar Tony K Nadackal Committed by Mauro Carvalho Chehab

media: s5p-jpeg: Correct WARN_ON statement for checking subsampling

Correct the WARN_ON statement for subsampling based on the
JPEG hardware version.
Signed-off-by: default avatarTony K Nadackal <tony.kn@samsung.com>
Signed-off-by: default avatarThierry Escande <thierry.escande@collabora.com>
Acked-by: default avatarAndrzej Pietrasiewicz <andrzej.p@samsung.com>
Acked-by: default avatarJacek Anaszewski <jacek.anaszewski@gmail.com>
Signed-off-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 5ea3bf28
...@@ -614,24 +614,26 @@ static inline struct s5p_jpeg_ctx *fh_to_ctx(struct v4l2_fh *fh) ...@@ -614,24 +614,26 @@ static inline struct s5p_jpeg_ctx *fh_to_ctx(struct v4l2_fh *fh)
static int s5p_jpeg_to_user_subsampling(struct s5p_jpeg_ctx *ctx) static int s5p_jpeg_to_user_subsampling(struct s5p_jpeg_ctx *ctx)
{ {
WARN_ON(ctx->subsampling > 3);
switch (ctx->jpeg->variant->version) { switch (ctx->jpeg->variant->version) {
case SJPEG_S5P: case SJPEG_S5P:
WARN_ON(ctx->subsampling > 3);
if (ctx->subsampling > 2) if (ctx->subsampling > 2)
return V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY; return V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY;
return ctx->subsampling; return ctx->subsampling;
case SJPEG_EXYNOS3250: case SJPEG_EXYNOS3250:
case SJPEG_EXYNOS5420: case SJPEG_EXYNOS5420:
WARN_ON(ctx->subsampling > 6);
if (ctx->subsampling > 3) if (ctx->subsampling > 3)
return V4L2_JPEG_CHROMA_SUBSAMPLING_411; return V4L2_JPEG_CHROMA_SUBSAMPLING_411;
return exynos3250_decoded_subsampling[ctx->subsampling]; return exynos3250_decoded_subsampling[ctx->subsampling];
case SJPEG_EXYNOS4: case SJPEG_EXYNOS4:
case SJPEG_EXYNOS5433: case SJPEG_EXYNOS5433:
WARN_ON(ctx->subsampling > 3);
if (ctx->subsampling > 2) if (ctx->subsampling > 2)
return V4L2_JPEG_CHROMA_SUBSAMPLING_420; return V4L2_JPEG_CHROMA_SUBSAMPLING_420;
return exynos4x12_decoded_subsampling[ctx->subsampling]; return exynos4x12_decoded_subsampling[ctx->subsampling];
default: default:
WARN_ON(ctx->subsampling > 3);
return V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY; return V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY;
} }
} }
......
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