vulkan/x11: use xcb_connection_has_error to check for failue

xcb_connectxx() always returns a non-NULL pointer to a
xcb_connection_t, even on failure.

cc: mesa-stable

Signed-off-by: YaoBing Xiao <xiaoyaobing@uniontech.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31812>
This commit is contained in:
YaoBing Xiao
2024-10-24 10:48:13 +08:00
committed by Marge Bot
parent d6535f2602
commit b63dfcc172

View File

@@ -70,8 +70,10 @@ int device_select_find_xcb_pci_default(struct device_pci_info *devices, uint32_t
drmDevicePtr xdev = NULL;
conn = xcb_connect(NULL, &scrn);
if (!conn)
if (xcb_connection_has_error(conn)) {
xcb_disconnect(conn);
return -1;
}
xcb_query_extension_cookie_t dri3_cookie;
xcb_query_extension_reply_t *dri3_reply = NULL;