From: monk.liu Date: Mon, 27 Apr 2015 07:23:54 +0000 (+0800) Subject: amdgpu: do not call BO_LIST ioctl when no resource referred X-Git-Tag: android-x86-6.0-r1~359 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=9c3bec246e5f1f7d2fcb2bd7e7cc0deab4d8b20d;p=android-x86%2Fexternal-libdrm.git amdgpu: do not call BO_LIST ioctl when no resource referred Signed-off-by: monk.liu Reviewed-by: Christian König Signed-off-by: Alex Deucher --- diff --git a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c index 72a2465c..91e6bcfc 100644 --- a/amdgpu/amdgpu_cs.c +++ b/amdgpu/amdgpu_cs.c @@ -635,6 +635,12 @@ static int amdgpu_cs_create_bo_list(amdgpu_device_handle dev, int r; num_resources = request->number_of_resources; + + if (!num_resources) { + *handle = 0; + return 0; + } + if (fence_ib) ++num_resources; @@ -671,6 +677,9 @@ static int amdgpu_cs_free_bo_list(amdgpu_device_handle dev, uint32_t handle) union drm_amdgpu_bo_list args; int r; + if (!handle) + return 0; + memset(&args, 0, sizeof(args)); args.in.operation = AMDGPU_BO_LIST_OP_DESTROY; args.in.list_handle = handle;