lkml.org 
[lkml]   [2017]   [Dec]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Staging: irda: Do not check for NOT NULL before kfree()
On Tue, 19 Dec 2017 00:41:30 +0530
Shreeya Patel <shreeya.patel23498@gmail.com> 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 <shreeya.patel23498@gmail.com>

Please read drivers/staging/irda/TODO

\
 
 \ /
  Last update: 2017-12-18 20:21    [W:0.032 / U:0.400 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site