From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753007AbdK1Owm (ORCPT ); Tue, 28 Nov 2017 09:52:42 -0500 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:33554 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752401AbdK1Owl (ORCPT ); Tue, 28 Nov 2017 09:52:41 -0500 X-IronPort-AV: E=Sophos;i="5.44,468,1505772000"; d="scan'208";a="302962665" Date: Tue, 28 Nov 2017 15:52:38 +0100 (CET) From: Julia Lawall X-X-Sender: jll@hadrien To: Karol Herbst cc: Ben Skeggs , David Airlie , nouveau , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, kbuild-all@01.org Subject: Re: [Nouveau] [PATCH] drm/nouveau/mmu: fix odd_ptr_err.cocci warnings (fwd) In-Reply-To: Message-ID: References: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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 > > To: kbuild@01.org > > Cc: Julia Lawall > > 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 > > CC: David Airlie > > 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 > > --- > > > > 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 >