From fa2ccd35d7deb4b00b5474e215691028a39c1b56 Mon Sep 17 00:00:00 2001 From: Narcisa Ana Maria Vasile Date: Wed, 1 Mar 2017 01:52:53 +0200 Subject: [PATCH] staging: bcm2835-camera: Refactored get_format function Now, when the condition inside the for is fulfilled, I return the result, instead of checking afterwards whether the counter has reached or not the end of the list. Signed-off-by: Narcisa Ana Maria Vasile Signed-off-by: Greg Kroah-Hartman --- .../staging/vc04_services/bcm2835-camera/bcm2835-camera.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c index 1baeef43d80c..53e275e70274 100644 --- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c +++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c @@ -229,13 +229,10 @@ static struct mmal_fmt *get_format(struct v4l2_format *f) for (k = 0; k < ARRAY_SIZE(formats); k++) { fmt = &formats[k]; if (fmt->fourcc == f->fmt.pix.pixelformat) - break; + return fmt; } - if (k == ARRAY_SIZE(formats)) - return NULL; - - return &formats[k]; + return NULL; } /* ------------------------------------------------------------------ -- 2.30.2