diff options
author | simran singhal <singhalsimran0@gmail.com> | 2017-03-04 22:16:55 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-03-09 19:06:36 +0100 |
commit | 6c849caf817da0c4e61003644043d55009114af8 (patch) | |
tree | 7361c09328a5a180110ced9ae4e5a8cd662aae59 /drivers | |
parent | 4e1c89dec89ac2b94faf2b1b39197086d0a6352d (diff) |
staging: vc04_services: 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: simran singhal <singhalsimran0@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c index e0ba0ed704fd..7fa0310e7b9e 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c @@ -52,7 +52,7 @@ int vchiu_queue_init(VCHIU_QUEUE_T *queue, int size) sema_init(&queue->push, 0); queue->storage = kzalloc(size * sizeof(VCHIQ_HEADER_T *), GFP_KERNEL); - if (queue->storage == NULL) { + if (!queue->storage) { vchiu_queue_delete(queue); return 0; } |