[PATCH v1] media:Fix repeated initialization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If the first report returns NULL,
there is no need to execute the
fimc_capture_try_format() function
again.

Signed-off-by: Wang Ming <machel@xxxxxxxx>
---
 .../media/platform/samsung/exynos4-is/fimc-capture.c   | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/samsung/exynos4-is/fimc-capture.c b/drivers/media/platform/samsung/exynos4-is/fimc-capture.c
index a0d43bf892e6..5ce2f04afa1e 100644
--- a/drivers/media/platform/samsung/exynos4-is/fimc-capture.c
+++ b/drivers/media/platform/samsung/exynos4-is/fimc-capture.c
@@ -825,10 +825,12 @@ static int fimc_pipeline_try_format(struct fimc_ctx *ctx,
 		tfmt->height = mf->height;
 		ffmt = fimc_capture_try_format(ctx, &tfmt->width, &tfmt->height,
 					NULL, &fcc, FIMC_SD_PAD_SINK_CAM);
-		ffmt = fimc_capture_try_format(ctx, &tfmt->width, &tfmt->height,
-					NULL, &fcc, FIMC_SD_PAD_SOURCE);
-		if (ffmt && ffmt->mbus_code)
-			mf->code = ffmt->mbus_code;
+		if (ffmt) {
+			ffmt = fimc_capture_try_format(ctx, &tfmt->width, &tfmt->height,
+				NULL, &fcc, FIMC_SD_PAD_SOURCE);
+			if (ffmt && ffmt->mbus_code)
+				mf->code = ffmt->mbus_code;
+		}
 		if (mf->width != tfmt->width || mf->height != tfmt->height)
 			continue;
 		tfmt->code = mf->code;
-- 
2.25.1




[Index of Archives]     [Linux SoC Development]     [Linux Rockchip Development]     [Linux for Synopsys ARC Processors]    
  • [Linux on Unisoc (RDA Micro) SoCs]     [Linux Actions SoC]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Linux SCSI]     [Yosemite News]

  •   Powered by Linux