From 2c2b0e8f83c1f9bb6020ed9ee8b56273352ef4eb Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sun, 24 Feb 2013 08:46:44 +0100 Subject: v4l2-drm-example: Stop mode lookup at first match Signed-off-by: Laurent Pinchart --- v4l2-drm-example/dmabuf-sharing.c | 7 +++++-- 1 file 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:"); -- cgit v1.2.3