From: woncheon.an Date: Wed, 1 Feb 2017 11:35:41 +0000 (+0900) Subject: [COMMON] media: scaler: modify minimum size check condition. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=cfd2e2780331dd2951f165e5f46b6c1e2d071fa7;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [COMMON] media: scaler: modify minimum size check condition. There's possibility that intermediate frame size violate to minimum input size during 2nd operation. but previous code can't check about minumum size restirction if ratio conditional sentence is false So intermediate frame size check codes are moved backward Change-Id: Icf0d01571037dc5f4c95c1acc66db1704370c9d1 Signed-off-by: woncheon.an --- diff --git a/drivers/media/platform/exynos/scaler/scaler-core.c b/drivers/media/platform/exynos/scaler/scaler-core.c index fcc201035f3b..baa4ebac731d 100644 --- a/drivers/media/platform/exynos/scaler/scaler-core.c +++ b/drivers/media/platform/exynos/scaler/scaler-core.c @@ -1342,42 +1342,34 @@ static int sc_prepare_2nd_scaling(struct sc_ctx *ctx, return -ENOMEM; limit = &sc->variant->limit_input; - if (*v_ratio > SCALE_RATIO_CONST(4, 1)) { + if (*v_ratio > SCALE_RATIO_CONST(4, 1)) crop.height = ((src_height + 7) / 8) * 2; - if (crop.height < limit->min_h) { - if (SCALE_RATIO(limit->min_h, - ctx->d_frame.crop.height) > - SCALE_RATIO_CONST(4, 1)) { - dev_err(sc->dev, - "Failed height scale down %d -> %d\n", - src_height, - ctx->d_frame.crop.height); - - free_intermediate_frame(ctx); - return -EINVAL; - } - crop.height = limit->min_h; + if (crop.height < limit->min_h) { + if (SCALE_RATIO(limit->min_h, ctx->d_frame.crop.height) + > SCALE_RATIO_CONST(4, 1)) { + dev_err(sc->dev, "Failed height scale down %d -> %d\n", + src_height, ctx->d_frame.crop.height); + + free_intermediate_frame(ctx); + return -EINVAL; } + crop.height = limit->min_h; } - if (*h_ratio > SCALE_RATIO_CONST(4, 1)) { + if (*h_ratio > SCALE_RATIO_CONST(4, 1)) crop.width = ((src_width + 7) / 8) * 2; - if (crop.width < limit->min_w) { - if (SCALE_RATIO(limit->min_w, - ctx->d_frame.crop.width) > - SCALE_RATIO_CONST(4, 1)) { - dev_err(sc->dev, - "Failed width scale down %d -> %d\n", - src_width, - ctx->d_frame.crop.width); - - free_intermediate_frame(ctx); - return -EINVAL; - } - crop.width = limit->min_w; + if (crop.width < limit->min_w) { + if (SCALE_RATIO(limit->min_w, ctx->d_frame.crop.width) + > SCALE_RATIO_CONST(4, 1)) { + dev_err(sc->dev, "Failed width scale down %d -> %d\n", + src_width, ctx->d_frame.crop.width); + + free_intermediate_frame(ctx); + return -EINVAL; } + crop.width = limit->min_w; } if (*v_ratio < SCALE_RATIO_CONST(1, 8)) {