From 3e3b8a40fee77d1af6ca0c2946ff276d555ddea8 Mon Sep 17 00:00:00 2001 From: Michal Srb Date: Mon, 27 Mar 2017 15:03:38 +0300 Subject: [PATCH] modesetting: Check for -1 before converting to unsigned int. dri2.c:516:21: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare] if (front->name < 0) Prevents a failure from being ignored. --- hw/xfree86/drivers/modesetting/dri2.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hw/xfree86/drivers/modesetting/dri2.c b/hw/xfree86/drivers/modesetting/dri2.c index b2278e78b..fd36aa118 100644 --- a/hw/xfree86/drivers/modesetting/dri2.c +++ b/hw/xfree86/drivers/modesetting/dri2.c @@ -511,11 +511,14 @@ update_front(DrawablePtr draw, DRI2BufferPtr front) ms_dri2_buffer_private_ptr priv = front->driverPrivate; CARD32 size; CARD16 pitch; + int name; - front->name = glamor_name_from_pixmap(pixmap, &pitch, &size); - if (front->name < 0) + name = glamor_name_from_pixmap(pixmap, &pitch, &size); + if (name < 0) return FALSE; + front->name = name; + (*screen->DestroyPixmap) (priv->pixmap); front->pitch = pixmap->devKind; front->cpp = pixmap->drawable.bitsPerPixel / 8;