]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
Staging: rtl8723au: Clean up tests if NULL returned on failure
authorBhumika Goyal <bhumirks@gmail.com>
Wed, 24 Feb 2016 10:23:57 +0000 (15:53 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 11 Mar 2016 03:44:34 +0000 (19:44 -0800)
Some functions like kmalloc/usb_alloc_urb returns Null as their return
value on failure. !x is generally preferred over x==NULL or NULL==x. So
make use of !x if the value returned on failure by these functions is NULL.
Done using coccinelle:

@@
expression e;
statement S;
@@
e = \(kmalloc\|devm_kzalloc\|kmalloc_array
     \|devm_ioremap\|usb_alloc_urb\|alloc_netdev\)(...);
- if(e==NULL)
+ if(!e)
  S

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c
drivers/staging/rtl8723au/os_dep/xmit_linux.c

index e3dc88961c2a262bc32c782b3acfb61861cec5dc..71d054900b8455e6a1fe7381e2d3494c007e4697 100644 (file)
@@ -399,7 +399,7 @@ hal_ReadEFuse_WiFi(struct rtw_adapter *padapter,
        }
 
        efuseTbl = kmalloc(EFUSE_MAP_LEN_8723A, GFP_KERNEL);
-       if (efuseTbl == NULL) {
+       if (!efuseTbl) {
                DBG_8723A("%s: alloc efuseTbl fail!\n", __func__);
                return;
        }
@@ -491,7 +491,7 @@ hal_ReadEFuse_BT(struct rtw_adapter *padapter,
        }
 
        efuseTbl = kmalloc(EFUSE_BT_MAP_LEN, GFP_KERNEL);
-       if (efuseTbl == NULL) {
+       if (!efuseTbl) {
                DBG_8723A("%s: efuseTbl malloc fail!\n", __func__);
                return;
        }
index 9a14074ecec0551cd583b8cb3c295d7e5aa7dbf9..64be72ac38ee706e5edb54f54a2302ae98438741 100644 (file)
@@ -37,7 +37,7 @@ int rtw_os_xmit_resource_alloc23a(struct rtw_adapter *padapter,
 
        for (i = 0; i < 8; i++) {
                pxmitbuf->pxmit_urb[i] = usb_alloc_urb(0, GFP_KERNEL);
-               if (pxmitbuf->pxmit_urb[i] == NULL) {
+               if (!pxmitbuf->pxmit_urb[i]) {
                        DBG_8723A("pxmitbuf->pxmit_urb[i]==NULL");
                        return _FAIL;
                }