From: Narcisa Ana Maria Vasile Date: Tue, 28 Feb 2017 23:52:53 +0000 (+0200) Subject: staging: bcm2835-camera: Refactored get_format function X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=fa2ccd35d7deb4b00b5474e215691028a39c1b56;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 --- 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; } /* ------------------------------------------------------------------