nvk: mem cannot be null in binding buffers/images.

Tom on discord pointed out a coverity warning in this area about
mem dereferences. Vulkan API states that mem must be non-NULL,
so remove those paths that are unused.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27255>
This commit is contained in:
Dave Airlie
2024-01-25 11:42:49 +10:00
committed by Marge Bot
parent 44b4fee786
commit 1d1a7f9d56
2 changed files with 14 additions and 27 deletions

View File

@@ -241,21 +241,14 @@ nvk_BindBufferMemory2(VkDevice device,
buffer->is_local = !(mem->bo->flags & NOUVEAU_WS_BO_GART);
if (buffer->vma_size_B) {
VK_FROM_HANDLE(nvk_device, dev, device);
if (mem != NULL) {
nouveau_ws_bo_bind_vma(dev->ws_dev,
mem->bo,
buffer->addr,
buffer->vma_size_B,
pBindInfos[i].memoryOffset,
0 /* pte_kind */);
} else {
nouveau_ws_bo_unbind_vma(dev->ws_dev,
buffer->addr,
buffer->vma_size_B);
}
nouveau_ws_bo_bind_vma(dev->ws_dev,
mem->bo,
buffer->addr,
buffer->vma_size_B,
pBindInfos[i].memoryOffset,
0 /* pte_kind */);
} else {
buffer->addr =
mem != NULL ? mem->bo->offset + pBindInfos[i].memoryOffset : 0;
buffer->addr = mem->bo->offset + pBindInfos[i].memoryOffset;
}
}
return VK_SUCCESS;

View File

@@ -830,21 +830,15 @@ nvk_image_plane_bind(struct nvk_device *dev,
*offset_B = align64(*offset_B, (uint64_t)plane->nil.align_B);
if (plane->vma_size_B) {
if (mem != NULL) {
nouveau_ws_bo_bind_vma(dev->ws_dev,
mem->bo,
plane->addr,
plane->vma_size_B,
*offset_B,
plane->nil.pte_kind);
} else {
nouveau_ws_bo_unbind_vma(dev->ws_dev,
plane->addr,
plane->vma_size_B);
}
nouveau_ws_bo_bind_vma(dev->ws_dev,
mem->bo,
plane->addr,
plane->vma_size_B,
*offset_B,
plane->nil.pte_kind);
} else {
assert(plane->nil.pte_kind == 0);
plane->addr = mem != NULL ? mem->bo->offset + *offset_B : 0;
plane->addr = mem->bo->offset + *offset_B;
}
*offset_B += plane->nil.size_B;