Skip to content

Commit

Permalink
staging: bcm2835-camera: Refactored get_format function
Browse files Browse the repository at this point in the history
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 <narcisaanamaria12@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Narcisa Ana Maria Vasile authored and Greg Kroah-Hartman committed Mar 6, 2017
1 parent 2430125 commit fa2ccd3
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/* ------------------------------------------------------------------
Expand Down

0 comments on commit fa2ccd3

Please sign in to comment.