diff options
author | Yuran Pereira <yuran.pereira@hotmail.com> | 2023-11-16 21:52:00 +0100 |
---|---|---|
committer | Danilo Krummrich <dakr@redhat.com> | 2023-11-30 01:04:12 +0100 |
commit | b101d08451de6eaebd1a840e4885ce7ce73656ad (patch) | |
tree | 9a9d00676f2d3659457ec1ce49092d8353d93f47 /drivers/gpu/drm/nouveau/nouveau_uvmm.c | |
parent | Documentation/gpu: VM_BIND locking document (diff) | |
download | linux-b101d08451de6eaebd1a840e4885ce7ce73656ad.tar.xz linux-b101d08451de6eaebd1a840e4885ce7ce73656ad.zip |
drm/nouveau: Removes unnecessary args check in nouveau_uvmm_sm_prepare
Checking `args` after calling `op_map_prepare` is unnecessary since
if `op_map_prepare` was to be called with NULL args, it would lead
to a NULL pointer dereference, thus never hitting that check.
Hence remove the check and add a note to remind users of this function
to ensure that args != NULL when calling this function for a map
operation as it was suggested by Danilo [1].
[1] https://lore.kernel.org/lkml/6a1ebcef-bade-45a0-9bd9-c05f0226eb88@redhat.com
Suggested-by: Danilo Krummrich <dakr@redhat.com>
Signed-off-by: Yuran Pereira <yuran.pereira@hotmail.com>
Signed-off-by: Danilo Krummrich <dakr@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/GV1PR10MB65637F4BAABFE2D8E261E1DCE8B0A@GV1PR10MB6563.EURPRD10.PROD.OUTLOOK.COM
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_uvmm.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_uvmm.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_uvmm.c b/drivers/gpu/drm/nouveau/nouveau_uvmm.c index 4b236da79509..dae3baf707a0 100644 --- a/drivers/gpu/drm/nouveau/nouveau_uvmm.c +++ b/drivers/gpu/drm/nouveau/nouveau_uvmm.c @@ -608,6 +608,9 @@ op_unmap_prepare(struct drm_gpuva_op_unmap *u) drm_gpuva_unmap(u); } +/* + * Note: @args should not be NULL when calling for a map operation. + */ static int nouveau_uvmm_sm_prepare(struct nouveau_uvmm *uvmm, struct nouveau_uvma_prealloc *new, @@ -628,7 +631,7 @@ nouveau_uvmm_sm_prepare(struct nouveau_uvmm *uvmm, if (ret) goto unwind; - if (args && vmm_get_range) { + if (vmm_get_range) { ret = nouveau_uvmm_vmm_get(uvmm, vmm_get_start, vmm_get_range); if (ret) { |