1
0
Fork 0

staging: rtl8188eu: os_dep: usb_intf: 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>
hifive-unleashed-5.1
Bhaktipriya Shridhar 2016-03-22 20:25:55 +05:30 committed by Greg Kroah-Hartman
parent 6e9aeda3fa
commit 574502caed
1 changed files with 1 additions and 1 deletions

View File

@ -60,7 +60,7 @@ static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf)
struct usb_device *pusbd;
pdvobjpriv = kzalloc(sizeof(*pdvobjpriv), GFP_KERNEL);
if (pdvobjpriv == NULL)
if (!pdvobjpriv)
return NULL;
pdvobjpriv->pusbintf = usb_intf;