From: Pekka Paalanen <pekka.paala...@collabora.co.uk> The head was just zalloc()'d, there is no need to memset it to zero.
If a function fails, it is preferable it leaves the output arguments untouched. Signed-off-by: Pekka Paalanen <pekka.paala...@collabora.co.uk> --- libweston/compositor-drm.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c index 352bd17b..8dfe2baf 100644 --- a/libweston/compositor-drm.c +++ b/libweston/compositor-drm.c @@ -4698,7 +4698,6 @@ drm_output_choose_initial_mode(struct drm_backend *backend, static int drm_head_read_current_setup(struct drm_head *head, struct drm_backend *backend) { - drmModeModeInfo *mode = &head->inherited_mode; int drm_fd = backend->drm.fd; drmModeEncoder *encoder; drmModeCrtc *crtc; @@ -4706,14 +4705,13 @@ drm_head_read_current_setup(struct drm_head *head, struct drm_backend *backend) /* Get the current mode on the crtc that's currently driving * this connector. */ encoder = drmModeGetEncoder(drm_fd, head->connector->encoder_id); - memset(mode, 0, sizeof *mode); if (encoder != NULL) { crtc = drmModeGetCrtc(drm_fd, encoder->crtc_id); drmModeFreeEncoder(encoder); if (crtc == NULL) return -1; if (crtc->mode_valid) - *mode = crtc->mode; + head->inherited_mode = crtc->mode; drmModeFreeCrtc(crtc); } @@ -5257,7 +5255,7 @@ drm_head_create(struct drm_backend *backend, uint32_t connector_id, if (drm_head_read_current_setup(head, backend) < 0) { weston_log("Failed to retrieve current mode from connector %d.\n", head->connector_id); - /* Continue, inherited_mode was memset to zero. */ + /* Not fatal. */ } weston_compositor_add_head(backend->compositor, &head->base); -- 2.13.6 _______________________________________________ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel