summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2013-02-24 08:46:44 +0100
committerTomasz Stanislawski <t.stanislaws@samsung.com>2013-03-13 10:49:34 +0100
commit2c2b0e8f83c1f9bb6020ed9ee8b56273352ef4eb (patch)
tree068368698239d379157d51e810693ca4fedbdf47
parent0cf71b73850f9625b2c9cbe798c002d03a7e6287 (diff)
v4l2-drm-example: Stop mode lookup at first match
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--v4l2-drm-example/dmabuf-sharing.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/v4l2-drm-example/dmabuf-sharing.c b/v4l2-drm-example/dmabuf-sharing.c
index 7d09e92..d72b6d9 100644
--- a/v4l2-drm-example/dmabuf-sharing.c
+++ b/v4l2-drm-example/dmabuf-sharing.c
@@ -267,9 +267,12 @@ static int find_mode(drmModeModeInfo *m, int drmfd, struct setup *s,
goto fail_conn;
drmModeModeInfo *found = NULL;
- for (int i = 0; i < c->count_modes; ++i)
- if (strcmp(c->modes[i].name, s->modestr) == 0)
+ for (int i = 0; i < c->count_modes; ++i) {
+ if (strcmp(c->modes[i].name, s->modestr) == 0) {
found = &c->modes[i];
+ break;
+ }
+ }
if (WARN_ON(!found, "mode %s not supported\n", s->modestr)) {
fprintf(stderr, "Valid modes:");