Thread (3 messages) 3 messages, 2 authors, 2017-12-18

Re: [PATCH] Staging: irda: Do not check for NOT NULL before kfree()

flat view

From: Stephen Hemminger <stephen@networkplumber.org>
Date: 2017-12-18 19:20:45
Also in: lkml

On Tue, 19 Dec 2017 00:41:30 +0530
Shreeya Patel [off-list ref] 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 <redacted>
Please read drivers/staging/irda/TODO
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help