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:
@@ -241,7 +241,6 @@ nvk_BindBufferMemory2(VkDevice device,
|
|||||||
buffer->is_local = !(mem->bo->flags & NOUVEAU_WS_BO_GART);
|
buffer->is_local = !(mem->bo->flags & NOUVEAU_WS_BO_GART);
|
||||||
if (buffer->vma_size_B) {
|
if (buffer->vma_size_B) {
|
||||||
VK_FROM_HANDLE(nvk_device, dev, device);
|
VK_FROM_HANDLE(nvk_device, dev, device);
|
||||||
if (mem != NULL) {
|
|
||||||
nouveau_ws_bo_bind_vma(dev->ws_dev,
|
nouveau_ws_bo_bind_vma(dev->ws_dev,
|
||||||
mem->bo,
|
mem->bo,
|
||||||
buffer->addr,
|
buffer->addr,
|
||||||
@@ -249,13 +248,7 @@ nvk_BindBufferMemory2(VkDevice device,
|
|||||||
pBindInfos[i].memoryOffset,
|
pBindInfos[i].memoryOffset,
|
||||||
0 /* pte_kind */);
|
0 /* pte_kind */);
|
||||||
} else {
|
} else {
|
||||||
nouveau_ws_bo_unbind_vma(dev->ws_dev,
|
buffer->addr = mem->bo->offset + pBindInfos[i].memoryOffset;
|
||||||
buffer->addr,
|
|
||||||
buffer->vma_size_B);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
buffer->addr =
|
|
||||||
mem != NULL ? mem->bo->offset + pBindInfos[i].memoryOffset : 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
|
@@ -830,21 +830,15 @@ nvk_image_plane_bind(struct nvk_device *dev,
|
|||||||
*offset_B = align64(*offset_B, (uint64_t)plane->nil.align_B);
|
*offset_B = align64(*offset_B, (uint64_t)plane->nil.align_B);
|
||||||
|
|
||||||
if (plane->vma_size_B) {
|
if (plane->vma_size_B) {
|
||||||
if (mem != NULL) {
|
|
||||||
nouveau_ws_bo_bind_vma(dev->ws_dev,
|
nouveau_ws_bo_bind_vma(dev->ws_dev,
|
||||||
mem->bo,
|
mem->bo,
|
||||||
plane->addr,
|
plane->addr,
|
||||||
plane->vma_size_B,
|
plane->vma_size_B,
|
||||||
*offset_B,
|
*offset_B,
|
||||||
plane->nil.pte_kind);
|
plane->nil.pte_kind);
|
||||||
} else {
|
|
||||||
nouveau_ws_bo_unbind_vma(dev->ws_dev,
|
|
||||||
plane->addr,
|
|
||||||
plane->vma_size_B);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
assert(plane->nil.pte_kind == 0);
|
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;
|
*offset_B += plane->nil.size_B;
|
||||||
|
Reference in New Issue
Block a user