]> git.karo-electronics.de Git - linux-beck.git/commitdiff
Staging: wilc1000: Remove null check before kfree
authorShraddha Barke <shraddha.6596@gmail.com>
Mon, 10 Aug 2015 08:00:33 +0000 (13:30 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 15 Aug 2015 01:44:45 +0000 (18:44 -0700)
kfree on NULL pointer is a no-op.

This patch uses the following semantic patch to find such 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>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 4b5e5b264e85b0ddbf52d4e3a564ad8be02974e4..e295e4ccad11bf9c28f48227f13560035797d29f 100644 (file)
@@ -2338,8 +2338,7 @@ int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd)
 
 done:
 
-       if (buff != NULL)
-               kfree(buff);
+       kfree(buff);
 
        return s32Error;
 }