Commit be40a5e2 authored by Tapasweni Pathak's avatar Tapasweni Pathak Committed by Greg Kroah-Hartman
Browse files

staging: unisys: visorchannel: Improved cleanup code



kfree on NULL pointer is a no-op.

This patch used the following semantic patch to find an instance where NULL
check is present before kfree

// <smpl>
@@ expression E; @@
- if (E != NULL) { kfree(E); }
+ kfree(E);
@@ expression E; @@
- if (E != NULL) { kfree(E); E = NULL; }
+ kfree(E);
+ E = NULL;
// </smpl>

Code is made more simpler by breaking up of sequence of kmallocs and adding
some more exit labels.
Removed unnecessary initialization of buf and fmtbuf to NULL as they are local
variables.

Suggested-by: default avatarArnd Bergmann <arnd@arndb.de>
Suggested-by: default avatarJulia Lawall <julia.lawall@lip6.fr>
Signed-off-by: default avatarTapasweni Pathak <tapaswenipathak@gmail.com>
Acked-by: default avatarJulia Lawall <julia.lawall@lip6.fr>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a707edd2
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment