kfree on NULL pointer is a no-op.
The semantic patch used -
// <smpl>
@@ expression E; @@
- if (E != NULL) { kfree(E); }
+ kfree(E);
@@ expression E; @@
- if (E != NULL) { kfree(E); E = NULL; }
+ kfree(E);
+ E = NULL;
// </smpl>smpl>
Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sdio_unregister_driver(&wilc_bus);
#endif
- if (g_linux_wlan != NULL) {
- kfree(g_linux_wlan);
- g_linux_wlan = NULL;
- }
+ kfree(g_linux_wlan);
+ g_linux_wlan = NULL;
printk("Module_exit Done.\n");
#if defined(WILC_DEBUGFS)