diff options
author | Bhumika Goyal <bhumirks@gmail.com> | 2016-02-24 15:53:57 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-03-10 19:44:34 -0800 |
commit | 28f5caa1679e18d4718f5ca6c6aaf95cbfc7afb5 (patch) | |
tree | 5132256c391dd4bf068b950597b7dd8f77e92035 /drivers/staging/rtl8723au | |
parent | 4e7c855eae56f9723b92d058505a9d87a5e9c76f (diff) | |
download | linux-28f5caa1679e18d4718f5ca6c6aaf95cbfc7afb5.tar.bz2 |
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: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/rtl8723au')
-rw-r--r-- | drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c | 4 | ||||
-rw-r--r-- | drivers/staging/rtl8723au/os_dep/xmit_linux.c | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c index e3dc88961c2a..71d054900b84 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c @@ -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; } diff --git a/drivers/staging/rtl8723au/os_dep/xmit_linux.c b/drivers/staging/rtl8723au/os_dep/xmit_linux.c index 9a14074ecec0..64be72ac38ee 100644 --- a/drivers/staging/rtl8723au/os_dep/xmit_linux.c +++ b/drivers/staging/rtl8723au/os_dep/xmit_linux.c @@ -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; } |