staging: replace explicit NULL comparison

Replace explicit NULL comparison with ! operator to
simplify code.

Found with Coccinelle script:
@@
expression ptr;
position p;
statement s0;
@@

ptr@p =
\(kmalloc\|devm_kzalloc\|kmalloc_array\|devm_ioremap\|usb_alloc_urb\|
alloc_netdev\|dev_alloc_skb\)(...)
... when != ptr

if (
(
+ !
ptr
- == NULL
)
) s0
This commit is contained in:
Christian Bremvåg 2019-08-16 23:10:38 +02:00 committed by GitHub
parent c18b6668eb
commit 0a4ce9dddc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -132,7 +132,7 @@ int rtw_os_xmit_resource_alloc(_adapter *padapter, struct xmit_buf *pxmitbuf, u3
int i; int i;
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
pxmitbuf->pxmit_urb[i] = usb_alloc_urb(0, GFP_KERNEL); pxmitbuf->pxmit_urb[i] = usb_alloc_urb(0, GFP_KERNEL);
if (pxmitbuf->pxmit_urb[i] == NULL) { if (!pxmitbuf->pxmit_urb[i]) {
RTW_INFO("pxmitbuf->pxmit_urb[i]==NULL"); RTW_INFO("pxmitbuf->pxmit_urb[i]==NULL");
return _FAIL; return _FAIL;
} }