mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-04 16:15:11 +00:00
staging: rtl8712: rtl871x_ioctl_linux: 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: Bhaktipriya Shridhar <bhaktipriya96@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
b1d0550055
commit
0b90c305c9
1 changed files with 2 additions and 2 deletions
|
@ -399,7 +399,7 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param,
|
||||||
if (wep_key_len > 0) {
|
if (wep_key_len > 0) {
|
||||||
wep_key_len = wep_key_len <= 5 ? 5 : 13;
|
wep_key_len = wep_key_len <= 5 ? 5 : 13;
|
||||||
pwep = kzalloc(sizeof(*pwep), GFP_ATOMIC);
|
pwep = kzalloc(sizeof(*pwep), GFP_ATOMIC);
|
||||||
if (pwep == NULL)
|
if (!pwep)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
pwep->KeyLength = wep_key_len;
|
pwep->KeyLength = wep_key_len;
|
||||||
pwep->Length = wep_key_len +
|
pwep->Length = wep_key_len +
|
||||||
|
@ -1793,7 +1793,7 @@ static int r871x_wx_set_enc_ext(struct net_device *dev,
|
||||||
|
|
||||||
param_len = sizeof(struct ieee_param) + pext->key_len;
|
param_len = sizeof(struct ieee_param) + pext->key_len;
|
||||||
param = kzalloc(param_len, GFP_ATOMIC);
|
param = kzalloc(param_len, GFP_ATOMIC);
|
||||||
if (param == NULL)
|
if (!param)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
param->cmd = IEEE_CMD_SET_ENCRYPTION;
|
param->cmd = IEEE_CMD_SET_ENCRYPTION;
|
||||||
eth_broadcast_addr(param->sta_addr);
|
eth_broadcast_addr(param->sta_addr);
|
||||||
|
|
Loading…
Reference in a new issue