From b8ecceb48b02681b968287c129785363d968a279 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 1 Feb 2021 14:22:53 +0100 Subject: [PATCH] Fix return value of get_plane_id The caller checks for 0, not negative values. --- src/drm.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/drm.cpp b/src/drm.cpp index f1fe4d3..b4985b8 100644 --- a/src/drm.cpp +++ b/src/drm.cpp @@ -143,17 +143,17 @@ static bool get_prop_value(struct drm_t *drm, drmModeObjectProperties *props, co /* Pick a plane.. something that at a minimum can be connected to * the chosen crtc, but prefer primary plane. */ -static int get_plane_id(struct drm_t *drm) +static uint32_t get_plane_id(struct drm_t *drm) { drmModePlaneResPtr plane_resources; uint32_t i; - int ret = -EINVAL; + uint32_t ret = 0; int found_primary = 0; plane_resources = drmModeGetPlaneResources(drm->fd); if (!plane_resources) { perror("drmModeGetPlaneResources failed"); - return -1; + return 0; } for (i = 0; (i < plane_resources->count_planes) && !found_primary; i++) { @@ -174,7 +174,7 @@ static int get_plane_id(struct drm_t *drm) uint64_t plane_type; if (!get_prop_value(drm, props, "type", &plane_type)) { fprintf(stderr, "Plane %" PRIu32 " is missing the type property", id); - return -1; + return 0; } if (plane_type == DRM_PLANE_TYPE_PRIMARY) {