loader/dri3: simplify check for reply
authorKonstantin Kharlamov <Hi-Angel@yandex.ru>
Tue, 9 Aug 2022 22:18:16 +0000 (01:18 +0300)
committerMarge Bot <emma+marge@anholt.net>
Fri, 12 Aug 2022 13:11:03 +0000 (13:11 +0000)
if reply == NULL, the call `free(reply)` is a no-op, so we can have a
single check instead of two.

Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17974>

src/loader/loader_dri3_helper.c

index 89f0d8e..6cae8eb 100644 (file)
@@ -1239,10 +1239,8 @@ loader_dri3_open(xcb_connection_t *conn,
                           provider);
 
    reply = xcb_dri3_open_reply(conn, cookie, NULL);
-   if (!reply)
-      return -1;
 
-   if (reply->nfd != 1) {
+   if (!reply || reply->nfd != 1) {
       free(reply);
       return -1;
    }