Commit 28f5caa1 authored by Bhumika Goyal's avatar Bhumika Goyal Committed by Greg Kroah-Hartman

Staging: rtl8723au: Clean up tests if NULL returned on failure

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: default avatarBhumika Goyal <bhumirks@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4e7c855e
...@@ -399,7 +399,7 @@ hal_ReadEFuse_WiFi(struct rtw_adapter *padapter, ...@@ -399,7 +399,7 @@ hal_ReadEFuse_WiFi(struct rtw_adapter *padapter,
} }
efuseTbl = kmalloc(EFUSE_MAP_LEN_8723A, GFP_KERNEL); efuseTbl = kmalloc(EFUSE_MAP_LEN_8723A, GFP_KERNEL);
if (efuseTbl == NULL) { if (!efuseTbl) {
DBG_8723A("%s: alloc efuseTbl fail!\n", __func__); DBG_8723A("%s: alloc efuseTbl fail!\n", __func__);
return; return;
} }
...@@ -491,7 +491,7 @@ hal_ReadEFuse_BT(struct rtw_adapter *padapter, ...@@ -491,7 +491,7 @@ hal_ReadEFuse_BT(struct rtw_adapter *padapter,
} }
efuseTbl = kmalloc(EFUSE_BT_MAP_LEN, GFP_KERNEL); efuseTbl = kmalloc(EFUSE_BT_MAP_LEN, GFP_KERNEL);
if (efuseTbl == NULL) { if (!efuseTbl) {
DBG_8723A("%s: efuseTbl malloc fail!\n", __func__); DBG_8723A("%s: efuseTbl malloc fail!\n", __func__);
return; return;
} }
......
...@@ -37,7 +37,7 @@ int rtw_os_xmit_resource_alloc23a(struct rtw_adapter *padapter, ...@@ -37,7 +37,7 @@ int rtw_os_xmit_resource_alloc23a(struct rtw_adapter *padapter,
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
pxmitbuf->pxmit_urb[i] = usb_alloc_urb(0, GFP_KERNEL); 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"); DBG_8723A("pxmitbuf->pxmit_urb[i]==NULL");
return _FAIL; return _FAIL;
} }
......
Markdown is supported
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