Skip to content

Commit fa2ccd3

Browse files
narcisaamgregkh
authored andcommitted
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 <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 2430125 commit fa2ccd3

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,13 +229,10 @@ static struct mmal_fmt *get_format(struct v4l2_format *f)
229229
for (k = 0; k < ARRAY_SIZE(formats); k++) {
230230
fmt = &formats[k];
231231
if (fmt->fourcc == f->fmt.pix.pixelformat)
232-
break;
232+
return fmt;
233233
}
234234

235-
if (k == ARRAY_SIZE(formats))
236-
return NULL;
237-
238-
return &formats[k];
235+
return NULL;
239236
}
240237

241238
/* ------------------------------------------------------------------

0 commit comments

Comments
 (0)