Commit 670e3fef authored by Bhaktipriya Shridhar's avatar Bhaktipriya Shridhar Committed by Greg Kroah-Hartman

staging: rtl8712: rtl871x_mlme: Clean up tests if NULL returned on failure

Some functions like kmalloc/kzalloc return NULL on failure.
When NULL represents failure, !x is commonly used.

This was done using Coccinelle:

@@
expression *e;
identifier l1;
@@

e = \(kmalloc\|kzalloc\|kcalloc\|devm_kzalloc\)(...);
...
- e == NULL
+ !e
Signed-off-by: default avatarBhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ddf6451f
...@@ -1205,7 +1205,7 @@ sint r8712_set_auth(struct _adapter *adapter, ...@@ -1205,7 +1205,7 @@ sint r8712_set_auth(struct _adapter *adapter,
return _FAIL; return _FAIL;
psetauthparm = kzalloc(sizeof(*psetauthparm), GFP_ATOMIC); psetauthparm = kzalloc(sizeof(*psetauthparm), GFP_ATOMIC);
if (psetauthparm == NULL) { if (!psetauthparm) {
kfree(pcmd); kfree(pcmd);
return _FAIL; return _FAIL;
} }
...@@ -1234,7 +1234,7 @@ sint r8712_set_key(struct _adapter *adapter, ...@@ -1234,7 +1234,7 @@ sint r8712_set_key(struct _adapter *adapter,
if (!pcmd) if (!pcmd)
return _FAIL; return _FAIL;
psetkeyparm = kzalloc(sizeof(*psetkeyparm), GFP_ATOMIC); psetkeyparm = kzalloc(sizeof(*psetkeyparm), GFP_ATOMIC);
if (psetkeyparm == NULL) { if (!psetkeyparm) {
ret = _FAIL; ret = _FAIL;
goto err_free_cmd; goto err_free_cmd;
} }
......
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