From 521860b2a92bab6394546e6af8709c07e2292033 Mon Sep 17 00:00:00 2001 From: Julien Isorce Date: Wed, 15 Mar 2017 17:40:25 +0000 Subject: [PATCH] radeon_drm_bo: explicitly check return value of drmCommandWriteRead MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit CID 1313492 Signed-off-by: Julien Isorce Reviewed-by: Marek Olšák --- src/gallium/winsys/radeon/drm/radeon_drm_bo.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c index f4ed3ce632b..f6d5c8a51c3 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c @@ -186,8 +186,13 @@ static enum radeon_bo_domain radeon_bo_get_initial_domain( args.handle = bo->handle; args.op = RADEON_GEM_OP_GET_INITIAL_DOMAIN; - drmCommandWriteRead(bo->rws->fd, DRM_RADEON_GEM_OP, - &args, sizeof(args)); + if (drmCommandWriteRead(bo->rws->fd, DRM_RADEON_GEM_OP, + &args, sizeof(args))) { + fprintf(stderr, "radeon: failed to get initial domain: %p 0x%08X\n", + bo, bo->handle); + /* Default domain as returned by get_valid_domain. */ + return RADEON_DOMAIN_VRAM_GTT; + } /* GEM domains and winsys domains are defined the same. */ return get_valid_domain(args.value); -- 2.30.2