Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

Some functions like 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>

authored by

Bhaktipriya Shridhar and committed by
Greg Kroah-Hartman
4d97b691 06884afc

+1 -1
+1 -1
drivers/staging/rtl8712/mlme_linux.c
··· 153 153 buff = NULL; 154 154 if (authmode == _WPA_IE_ID_) { 155 155 buff = kzalloc(IW_CUSTOM_MAX, GFP_ATOMIC); 156 - if (buff == NULL) 156 + if (!buff) 157 157 return; 158 158 p = buff; 159 159 p += sprintf(p, "ASSOCINFO(ReqIEs=");