Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp811910pxb; Wed, 13 Apr 2022 13:01:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy9K1aTD6vnqiDnNLXcnLlBd6BJeadHpv31e0FX562SzrHqstCU8aAuUdC/31676YT2A7vq X-Received: by 2002:a05:6402:b2f:b0:41d:7896:5042 with SMTP id bo15-20020a0564020b2f00b0041d78965042mr19162275edb.139.1649880069558; Wed, 13 Apr 2022 13:01:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649880069; cv=none; d=google.com; s=arc-20160816; b=Tic3wfdNoF7YoWGm4ubAqKn5A4ed4/guBBBx51YMihQuh/ZscoAZML14FIhsAMvm6N orJM28TwlkyGyPTtIzucbeY4LUkuOgeMaVotY/I9qlJjKDNoFzsmxUgqGnS0ucz84C0D hHPPefFBlEzdhjOZLc8E5z+QnUkThtON3GhMLf45bA9BsxjqSFNaUKG8rje2JEJlDT/v 683xvQPEB0HMGlojOyB8pVoFV8zmKSslTSEVu+hvxlZlaGXUMdVMPiZv7QBSwCs+5llf yHa6K1+dJzmMrDKXFCrlsagmbg7zimtmur75WED12HzXCjcCt19yc2MLaHNxBYpwjG6+ 0biA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=SsucQ7nmn7o3XX8IffWSB3JEjgB0jcdkwzAiY6kF2ec=; b=Yr9pV6G9BobFSZQ45KVFs8BDth2JAVmWaQGcOxOTwX7yN+PrG1Pz8lfthkhHU3AkwA si1+oKXFwNJbTpAJFlpCMS1cUAxYQCqgyPHOjw0du9/g11jN7j6abkj0AhL5Xpr3dbXk VJuGXrk4OBFT392A6dq1MBK5YmPhJ9WMRoP2Utd6ymZUptJZF1hvYQE7GxRTTPBimI1y aoGnjCu0jqGstmTjlf3EfzG/eK2Bjyc6aVVgCNj7h1oMN4oUaa1uGloSdKjUrUovN1Qf VD1HgE8WFOPUlhTfypV/OQqKI9DSimoJMeln41gbDXw6aAlfQpHIHYG6w7i7g7Tf4/jC lEJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kapsi.fi header.s=20161220 header.b=unmLUqce; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rn26-20020a170906d93a00b006df846edd5fsi524690ejb.998.2022.04.13.13.00.42; Wed, 13 Apr 2022 13:01:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@kapsi.fi header.s=20161220 header.b=unmLUqce; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229620AbiDMHXR (ORCPT + 99 others); Wed, 13 Apr 2022 03:23:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231905AbiDMHXQ (ORCPT ); Wed, 13 Apr 2022 03:23:16 -0400 Received: from mail.kapsi.fi (mail.kapsi.fi [IPv6:2001:67c:1be8::25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FD8E192BA; Wed, 13 Apr 2022 00:20:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kapsi.fi; s=20161220; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=SsucQ7nmn7o3XX8IffWSB3JEjgB0jcdkwzAiY6kF2ec=; b=unmLUqce1/2h2GtG3P5xPxfgMb 29bBzJeutu7zmgnSMoVqlQWV6kgI5O884c8KbUyvzK0Ph6dmKwpmdFfkGlUwcEmZ5MlnenC0SYa2z W/P3w9Mv5e9u0AMjsEa626MkRji6gmSWNyfuZGfoseqpd6YQ1NHJZRLNFxSb1avF8C+A45OePxGKZ Uw+YgiemDJFU5bfT/tYMFtyA8hjf+db5udHAn1H+hR/Aco5HIaV4jYYQbeJxMEDDGnQKeekoFCXe4 jaqWy77xXJYfodv7AuLSlfPO60dKorZnEy7X/CC5iUed8vNwQXIFWBJRNmAQtJny0ORZdkq5DfADH CBlg7Frg==; Received: from 91-158-25-70.elisa-laajakaista.fi ([91.158.25.70] helo=[192.168.1.10]) by mail.kapsi.fi with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1neXIv-0007di-Gw; Wed, 13 Apr 2022 10:20:41 +0300 Message-ID: <6afbd04c-9847-a62c-12bf-f49314ae2664@kapsi.fi> Date: Wed, 13 Apr 2022 10:20:41 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.1 Subject: Re: [PATCH] gpu/host1x: remove useless if(ptr) check to kfree Content-Language: en-US To: Bernard Zhao , Thierry Reding , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Cc: bernard@vivo.com References: <20220413063934.23571-1-zhaojunkui2008@126.com> From: Mikko Perttunen In-Reply-To: <20220413063934.23571-1-zhaojunkui2008@126.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 91.158.25.70 X-SA-Exim-Mail-From: cyndis@kapsi.fi X-SA-Exim-Scanned: No (on mail.kapsi.fi); SAEximRunCond expanded to false X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/13/22 09:39, Bernard Zhao wrote: > This patch remove useless if(ptr) check to kfree. > > Signed-off-by: Bernard Zhao > --- > drivers/gpu/host1x/fence.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/gpu/host1x/fence.c b/drivers/gpu/host1x/fence.c > index ecab72882192..05b36bfc8b74 100644 > --- a/drivers/gpu/host1x/fence.c > +++ b/drivers/gpu/host1x/fence.c > @@ -93,8 +93,7 @@ static void host1x_syncpt_fence_release(struct dma_fence *f) > { > struct host1x_syncpt_fence *sf = to_host1x_fence(f); > > - if (sf->waiter) > - kfree(sf->waiter); > + kfree(sf->waiter); > > dma_fence_free(f); > } I personally dislike leaving the NULL checks off with calls to kfree. With the NULL check there, while reading the code it is obvious that the intention is that the value can be either a valid pointer or NULL. IMHO with C's type system/conventions we need this kind of contextual information to understand the code easily and avoid bugs. Mikko