From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [PATCH] Staging: irda: Do not check for NOT NULL before kfree() Date: Mon, 18 Dec 2017 11:20:38 -0800 Message-ID: <20171218112038.15626e20@xeon-e3> References: <1513624290-2965-1-git-send-email-shreeya.patel23498@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: devel@driverdev.osuosl.org, gregkh@linuxfoundation.org, samuel@sortiz.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org To: Shreeya Patel Return-path: In-Reply-To: <1513624290-2965-1-git-send-email-shreeya.patel23498@gmail.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: driverdev-devel-bounces@linuxdriverproject.org Sender: "devel" List-Id: netdev.vger.kernel.org On Tue, 19 Dec 2017 00:41:30 +0530 Shreeya Patel wrote: > Do not check for NOT NULL before calling kfree because if the > pointer is NULL, no action occurs. > Done using the following semantic patch by coccinelle. > > @@ > expression ptr; > @@ > > - if (ptr != NULL) { > kfree(ptr); > ptr = NULL; > - } > > The semantic patch has the effect of adding an assignment > of ptr to NULL in the case where ptr is NULL already. > > Signed-off-by: Shreeya Patel Please read drivers/staging/irda/TODO