* [PATCH] drm/nouveau/svm: remove unused ret variable
@ 2023-03-29 23:14 Tom Rix
2023-04-07 18:01 ` Nick Desaulniers
0 siblings, 1 reply; 2+ messages in thread
From: Tom Rix @ 2023-03-29 23:14 UTC (permalink / raw)
To: bskeggs, kherbst, lyude, airlied, daniel, nathan, ndesaulniers
Cc: dri-devel, nouveau, linux-kernel, llvm, 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.
Signed-off-by: Tom Rix <trix@redhat.com>
---
drivers/gpu/drm/nouveau/nouveau_svm.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/nouveau_svm.c b/drivers/gpu/drm/nouveau/nouveau_svm.c
index a74ba8d84ba7..e072d610f2f9 100644
--- a/drivers/gpu/drm/nouveau/nouveau_svm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_svm.c
@@ -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);
}
--
2.27.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/nouveau/svm: remove unused ret variable
2023-03-29 23:14 [PATCH] drm/nouveau/svm: remove unused ret variable Tom Rix
@ 2023-04-07 18:01 ` Nick Desaulniers
0 siblings, 0 replies; 2+ messages in thread
From: Nick Desaulniers @ 2023-04-07 18:01 UTC (permalink / raw)
To: Tom Rix
Cc: bskeggs, kherbst, lyude, airlied, daniel, nathan, dri-devel,
nouveau, linux-kernel, llvm
On Wed, Mar 29, 2023 at 4:14 PM Tom Rix <trix@redhat.com> wrote:
>
> 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.
>
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
> drivers/gpu/drm/nouveau/nouveau_svm.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nouveau_svm.c b/drivers/gpu/drm/nouveau/nouveau_svm.c
> index a74ba8d84ba7..e072d610f2f9 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_svm.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_svm.c
> @@ -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);
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
>
> mutex_unlock(&svmm->mutex);
> }
> --
> 2.27.0
>
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-04-07 18:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-29 23:14 [PATCH] drm/nouveau/svm: remove unused ret variable Tom Rix
2023-04-07 18:01 ` Nick Desaulniers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®