diff options
author | Bhumika Goyal <bhumirks@gmail.com> | 2016-02-24 16:09:31 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-03-11 22:09:09 -0800 |
commit | 9155c92463ecbb55c6eca6145e139869e9ba1546 (patch) | |
tree | 91e983d48b730fbdd2a26477e452bc04701fa927 /drivers/staging/rtl8712/rtl871x_mlme.c | |
parent | staging: rtl8712: Remove unnecessary parantheses (diff) | |
download | linux-dev-9155c92463ecbb55c6eca6145e139869e9ba1546.tar.xz linux-dev-9155c92463ecbb55c6eca6145e139869e9ba1546.zip |
Staging: rtl8712: Clean up tests if NULL returned on failure
Some functions like kmalloc/usb_alloc_urb/kmalloc_array 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/rtl8712/rtl871x_mlme.c')
-rw-r--r-- | drivers/staging/rtl8712/rtl871x_mlme.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c index 1b022dbda046..14a780efba90 100644 --- a/drivers/staging/rtl8712/rtl871x_mlme.c +++ b/drivers/staging/rtl8712/rtl871x_mlme.c @@ -64,7 +64,7 @@ static sint _init_mlme_priv(struct _adapter *padapter) memset(&pmlmepriv->assoc_ssid, 0, sizeof(struct ndis_802_11_ssid)); pbuf = kmalloc_array(MAX_BSS_CNT, sizeof(struct wlan_network), GFP_ATOMIC); - if (pbuf == NULL) + if (!pbuf) return _FAIL; pmlmepriv->free_bss_buf = pbuf; pnetwork = (struct wlan_network *)pbuf; @@ -1202,7 +1202,7 @@ sint r8712_set_auth(struct _adapter *adapter, struct setauth_parm *psetauthparm; pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC); - if (pcmd == NULL) + if (!pcmd) return _FAIL; psetauthparm = kzalloc(sizeof(*psetauthparm), GFP_ATOMIC); @@ -1232,7 +1232,7 @@ sint r8712_set_key(struct _adapter *adapter, sint ret = _SUCCESS; pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC); - if (pcmd == NULL) + if (!pcmd) return _FAIL; psetkeyparm = kzalloc(sizeof(*psetkeyparm), GFP_ATOMIC); if (psetkeyparm == NULL) { |