summaryrefslogtreecommitdiff
path: root/v4l2-drm-example
diff options
context:
space:
mode:
Diffstat (limited to 'v4l2-drm-example')
-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:");