* [PATCH] drm/nouveau/mmu: fix odd_ptr_err.cocci warnings (fwd)
@ 2017-11-28 12:56 Julia Lawall
2017-11-28 14:50 ` Karol Herbst
0 siblings, 1 reply; 3+ messages in thread
From: Julia Lawall @ 2017-11-28 12:56 UTC (permalink / raw)
To: Ben Skeggs; +Cc: David Airlie, nouveau, linux-kernel, dri-devel, kbuild-all
This is a false positive, but I wonder if it is really necessary to put
the assignment in the conditional test expression.
julia
---------- Forwarded message ----------
Date: Tue, 28 Nov 2017 13:23:36 +0800
From: kbuild test robot <fengguang.wu@intel.com>
To: kbuild@01.org
Cc: Julia Lawall <julia.lawall@lip6.fr>
Subject: [PATCH] drm/nouveau/mmu: fix odd_ptr_err.cocci warnings
CC: kbuild-all@01.org
CC: linux-kernel@vger.kernel.org
TO: Ben Skeggs <bskeggs@redhat.com>
CC: David Airlie <airlied@linux.ie>
CC: dri-devel@lists.freedesktop.org
CC: nouveau@lists.freedesktop.org
CC: linux-kernel@vger.kernel.org
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c:109:5-11: inconsistent IS_ERR and PTR_ERR on line 110.
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c:109:5-11: inconsistent IS_ERR and PTR_ERR on line 111.
PTR_ERR should access the value just tested by IS_ERR
Semantic patch information:
There can be false positives in the patch case, where it is the call to
IS_ERR that is wrong.
Generated by: scripts/coccinelle/tests/odd_ptr_err.cocci
Fixes: 920d2b5ef215 ("drm/nouveau/mmu: define user interfaces to mmu vmm opertaions")
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---
Please take the patch only if it's a positive warning. Thanks!
uvmm.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c
@@ -107,8 +107,9 @@ nvkm_uvmm_mthd_map(struct nvkm_uvmm *uvm
return ret;
if (IS_ERR((memory = nvkm_umem_search(client, handle)))) {
- VMM_DEBUG(vmm, "memory %016llx %ld\n", handle, PTR_ERR(memory));
- return PTR_ERR(memory);
+ VMM_DEBUG(vmm, "memory %016llx %ld\n", handle,
+ PTR_ERR((memory = nvkm_umem_search(client, handle))));
+ return PTR_ERR((memory = nvkm_umem_search(client, handle)));
}
mutex_lock(&vmm->mutex);
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/nouveau/mmu: fix odd_ptr_err.cocci warnings (fwd)
2017-11-28 12:56 [PATCH] drm/nouveau/mmu: fix odd_ptr_err.cocci warnings (fwd) Julia Lawall
@ 2017-11-28 14:50 ` Karol Herbst
2017-11-28 14:52 ` [Nouveau] " Julia Lawall
0 siblings, 1 reply; 3+ messages in thread
From: Karol Herbst @ 2017-11-28 14:50 UTC (permalink / raw)
To: Julia Lawall
Cc: David Airlie, nouveau, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
kbuild-all-JC7UmRfGjtg, Ben Skeggs
Hi julia,
I think it would be better to extract the assignment out of the if
clause. Then you'll get something like this:
memory = ...;
if (IS_ERR(memory)) {
....
}
so, to answer your question: no, it isn't necessary.
On Tue, Nov 28, 2017 at 1:56 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> This is a false positive, but I wonder if it is really necessary to put
> the assignment in the conditional test expression.
>
> julia
>
> ---------- Forwarded message ----------
> Date: Tue, 28 Nov 2017 13:23:36 +0800
> From: kbuild test robot <fengguang.wu@intel.com>
> To: kbuild@01.org
> Cc: Julia Lawall <julia.lawall@lip6.fr>
> Subject: [PATCH] drm/nouveau/mmu: fix odd_ptr_err.cocci warnings
>
> CC: kbuild-all@01.org
> CC: linux-kernel@vger.kernel.org
> TO: Ben Skeggs <bskeggs@redhat.com>
> CC: David Airlie <airlied@linux.ie>
> CC: dri-devel@lists.freedesktop.org
> CC: nouveau@lists.freedesktop.org
> CC: linux-kernel@vger.kernel.org
>
> drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c:109:5-11: inconsistent IS_ERR and PTR_ERR on line 110.
> drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c:109:5-11: inconsistent IS_ERR and PTR_ERR on line 111.
>
> PTR_ERR should access the value just tested by IS_ERR
>
> Semantic patch information:
> There can be false positives in the patch case, where it is the call to
> IS_ERR that is wrong.
>
> Generated by: scripts/coccinelle/tests/odd_ptr_err.cocci
>
> Fixes: 920d2b5ef215 ("drm/nouveau/mmu: define user interfaces to mmu vmm opertaions")
> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
> ---
>
> Please take the patch only if it's a positive warning. Thanks!
>
> uvmm.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c
> @@ -107,8 +107,9 @@ nvkm_uvmm_mthd_map(struct nvkm_uvmm *uvm
> return ret;
>
> if (IS_ERR((memory = nvkm_umem_search(client, handle)))) {
> - VMM_DEBUG(vmm, "memory %016llx %ld\n", handle, PTR_ERR(memory));
> - return PTR_ERR(memory);
> + VMM_DEBUG(vmm, "memory %016llx %ld\n", handle,
> + PTR_ERR((memory = nvkm_umem_search(client, handle))));
> + return PTR_ERR((memory = nvkm_umem_search(client, handle)));
> }
>
> mutex_lock(&vmm->mutex);
> _______________________________________________
> Nouveau mailing list
> Nouveau@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/nouveau
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Nouveau] [PATCH] drm/nouveau/mmu: fix odd_ptr_err.cocci warnings (fwd)
2017-11-28 14:50 ` Karol Herbst
@ 2017-11-28 14:52 ` Julia Lawall
0 siblings, 0 replies; 3+ messages in thread
From: Julia Lawall @ 2017-11-28 14:52 UTC (permalink / raw)
To: Karol Herbst
Cc: David Airlie, nouveau, linux-kernel, dri-devel, kbuild-all,
Ben Skeggs
On Tue, 28 Nov 2017, Karol Herbst wrote:
> Hi julia,
>
> I think it would be better to extract the assignment out of the if
> clause. Then you'll get something like this:
>
> memory = ...;
> if (IS_ERR(memory)) {
> ....
> }
>
> so, to answer your question: no, it isn't necessary.
Will someone take care of it? I'm just the 0-day proxy :)
julia
> On Tue, Nov 28, 2017 at 1:56 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> > This is a false positive, but I wonder if it is really necessary to put
> > the assignment in the conditional test expression.
> >
> > julia
> >
> > ---------- Forwarded message ----------
> > Date: Tue, 28 Nov 2017 13:23:36 +0800
> > From: kbuild test robot <fengguang.wu@intel.com>
> > To: kbuild@01.org
> > Cc: Julia Lawall <julia.lawall@lip6.fr>
> > Subject: [PATCH] drm/nouveau/mmu: fix odd_ptr_err.cocci warnings
> >
> > CC: kbuild-all@01.org
> > CC: linux-kernel@vger.kernel.org
> > TO: Ben Skeggs <bskeggs@redhat.com>
> > CC: David Airlie <airlied@linux.ie>
> > CC: dri-devel@lists.freedesktop.org
> > CC: nouveau@lists.freedesktop.org
> > CC: linux-kernel@vger.kernel.org
> >
> > drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c:109:5-11: inconsistent IS_ERR and PTR_ERR on line 110.
> > drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c:109:5-11: inconsistent IS_ERR and PTR_ERR on line 111.
> >
> > PTR_ERR should access the value just tested by IS_ERR
> >
> > Semantic patch information:
> > There can be false positives in the patch case, where it is the call to
> > IS_ERR that is wrong.
> >
> > Generated by: scripts/coccinelle/tests/odd_ptr_err.cocci
> >
> > Fixes: 920d2b5ef215 ("drm/nouveau/mmu: define user interfaces to mmu vmm opertaions")
> > Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
> > ---
> >
> > Please take the patch only if it's a positive warning. Thanks!
> >
> > uvmm.c | 5 +++--
> > 1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > --- a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c
> > +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c
> > @@ -107,8 +107,9 @@ nvkm_uvmm_mthd_map(struct nvkm_uvmm *uvm
> > return ret;
> >
> > if (IS_ERR((memory = nvkm_umem_search(client, handle)))) {
> > - VMM_DEBUG(vmm, "memory %016llx %ld\n", handle, PTR_ERR(memory));
> > - return PTR_ERR(memory);
> > + VMM_DEBUG(vmm, "memory %016llx %ld\n", handle,
> > + PTR_ERR((memory = nvkm_umem_search(client, handle))));
> > + return PTR_ERR((memory = nvkm_umem_search(client, handle)));
> > }
> >
> > mutex_lock(&vmm->mutex);
> > _______________________________________________
> > Nouveau mailing list
> > Nouveau@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/nouveau
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-11-28 14:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-28 12:56 [PATCH] drm/nouveau/mmu: fix odd_ptr_err.cocci warnings (fwd) Julia Lawall
2017-11-28 14:50 ` Karol Herbst
2017-11-28 14:52 ` [Nouveau] " Julia Lawall
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).