From: "Jan Beulich" Subject: Re: [PATCH 4/5] tmem: Pointless check of NULL against an array Date: Tue, 26 Nov 2013 08:27:39 +0000 Message-ID: <5294698B0200007800106FB7@nat28.tlf.novell.com> References: <1385398842-8247-1-git-send-email-konrad.wilk@oracle.com> <1385398842-8247-5-git-send-email-konrad.wilk@oracle.com> <529386A4.9020005@citrix.com> <20131125195429.GE3339@phenom.dumpdata.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VlDzk-0008Uw-7p for xen-devel@lists.xenproject.org; Tue, 26 Nov 2013 08:27:44 +0000 In-Reply-To: <20131125195429.GE3339@phenom.dumpdata.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper , Konrad Rzeszutek Wilk Cc: xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org >>> On 25.11.13 at 20:54, Konrad Rzeszutek Wilk wrote: > On Mon, Nov 25, 2013 at 05:19:32PM +0000, Andrew Cooper wrote: >> On 25/11/13 17:00, Konrad Rzeszutek Wilk wrote: >> > CID 1055632 tells us that we are comparing an array to a NULL >> > which is indeed silly. Lets not do it. >> > >> > CC: Bob Liu >> > Signed-off-by: Konrad Rzeszutek Wilk >> > --- >> > xen/common/tmem.c | 2 -- >> > 1 file changed, 2 deletions(-) >> > >> > diff --git a/xen/common/tmem.c b/xen/common/tmem.c >> > index 3bc35fd..1ebed8a 100644 >> > --- a/xen/common/tmem.c >> > +++ b/xen/common/tmem.c >> > @@ -1798,8 +1798,6 @@ static int do_tmem_destroy_pool(uint32_t pool_id) >> > struct client *client = tmem_client_from_current(); >> > struct tmem_pool *pool; >> > >> > - if ( client->pools == NULL ) >> > - return 0; >> >> client->pools certainly can't be null, but client certainly can. This >> should be "if ( !client )" > > No need. The caller of this function does that already and if there > does not exist one - it will create one. > > I can add an ASSERT here? Yes. Or just pass the already validated "client" into the function. Jan