Skip to contentSkip to conversation

drm/nouveau/svm: remove unused ret variable

PATCH In review Tom Rix 2 participants 2 messages Mar 29, 2023 – Apr 7, 2023

Subsystems (3)
lore
Share & tools
lore

Tom Rix

author
#0 lore raw

PATCH 1/1 drm/nouveau/svm: remove unused ret variable

clang with W=1 reports drivers/gpu/drm/nouveau/nouveau_svm.c:929:6: error: variable
'ret' set but not used [-Werror,-Wunused-but-set-variable]

        int ret;
            ^

This variable is not used so remove it.

---
 drivers/gpu/drm/nouveau/nouveau_svm.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/nouveau/nouveau_svm.c +2 -3
index a74ba8d84ba7..e072d610f2f9 100644
@@ -926,15 +926,14 @@ nouveau_pfns_map(struct nouveau_svmm *svmm, struct mm_struct *mm,
 		 unsigned long addr, u64 *pfns, unsigned long npages)
 {
 	struct nouveau_pfnmap_args *args = nouveau_pfns_to_args(pfns);
-	int ret;
 
 	args->p.addr = addr;
 	args->p.size = npages << PAGE_SHIFT;
 
 	mutex_lock(&svmm->mutex);
 
-	ret = nvif_object_ioctl(&svmm->vmm->vmm.object, args,
-				struct_size(args, p.phys, npages), NULL);
+	nvif_object_ioctl(&svmm->vmm->vmm.object, args,
+			  struct_size(args, p.phys, npages), NULL);
 
 	mutex_unlock(&svmm->mutex);
 }
Signature · 1 line
2.27.0
#1 lore raw
Quoted 22 lines · Tom Rix

clang with W=1 reports drivers/gpu/drm/nouveau/nouveau_svm.c:929:6: error: variable
'ret' set but not used [-Werror,-Wunused-but-set-variable]

        int ret;
            ^

This variable is not used so remove it.

---
 drivers/gpu/drm/nouveau/nouveau_svm.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/nouveau/nouveau_svm.c +0 -1
index a74ba8d84ba7..e072d610f2f9 100644
@@ -926,15 +926,14 @@ nouveau_pfns_map(struct nouveau_svmm *svmm, struct mm_struct *mm,
                 unsigned long addr, u64 *pfns, unsigned long npages)
 {
        struct nouveau_pfnmap_args *args = nouveau_pfns_to_args(pfns);
-       int ret;

drivers/gpu/drm/nouveau/nouveau_svm.c nouveau_pfns_map(struct nouveau_svmm *svmm, struct mm_struct *mm, · line 936

Quoted 10 lines
drivers/gpu/drm/nouveau/nouveau_svm.c +2 -2
 
        args->p.addr = addr;
        args->p.size = npages << PAGE_SHIFT;
 
        mutex_lock(&svmm->mutex);
 
-       ret = nvif_object_ioctl(&svmm->vmm->vmm.object, args,
-                               struct_size(args, p.phys, npages), NULL);
+       nvif_object_ioctl(&svmm->vmm->vmm.object, args,
+                         struct_size(args, p.phys, npages), NULL);

nvif_object_ioctl() may return -ENOSYS. Seeing other call sites have comments like:
114 /*XXX: warn? */
134 /*XXX: warn? */

or other places where the return code isn't checked makes me think that a better approach would be to
1. plumb error codes back up through nouveau_pfns_map() (and other call sites of nvif_object_ioctl)
2. consider making nvif_object_ioctl __must_check

Quoted 6 lines
drivers/gpu/drm/nouveau/nouveau_svm.c +0 -1
        mutex_unlock(&svmm->mutex);
 }
--

2.27.0

Signature · 2 lines
Thanks,
~Nick Desaulniers