Staging: wilc1000: linux_wlan: Remove NULL check before kfree
authorShraddha Barke <shraddha.6596@gmail.com>
Mon, 12 Oct 2015 15:19:20 +0000 (20:49 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Oct 2015 04:02:25 +0000 (21:02 -0700)
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>
drivers/staging/wilc1000/linux_wlan.c

index fe4f3051916dba13965b2e66e9917ef9ed274a8a..ccab89f8b0cc4cb56a44a0a4c61858d3a6d4e941 100644 (file)
@@ -1887,10 +1887,8 @@ static void __exit exit_wilc_driver(void)
        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)