staging: atomisp_fops: Clean up tests if NULL returned on failure
authorsimran singhal <singhalsimran0@gmail.com>
Fri, 10 Mar 2017 05:13:10 +0000 (10:43 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 12 Mar 2017 13:57:00 +0000 (14:57 +0100)
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c

index 20e581e5a94b6d53253ada13d4920d782241f440..e5a7407bf7ab054166c7cf05a7e8e7be0273e13b 100644 (file)
@@ -1100,7 +1100,7 @@ int atomisp_videobuf_mmap_mapper(struct videobuf_queue *q,
                        continue;
 
                map = kzalloc(sizeof(struct videobuf_mapping), GFP_KERNEL);
-               if (map == NULL) {
+               if (!map) {
                        mutex_unlock(&q->vb_lock);
                        return -ENOMEM;
                }