Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 95738786 authored by simran singhal's avatar simran singhal Committed by Greg Kroah-Hartman
Browse files

staging: atomisp_fops: 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: default avatarsimran singhal <singhalsimran0@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7cf51d34
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -1100,7 +1100,7 @@ int atomisp_videobuf_mmap_mapper(struct videobuf_queue *q,
			continue;
			continue;


		map = kzalloc(sizeof(struct videobuf_mapping), GFP_KERNEL);
		map = kzalloc(sizeof(struct videobuf_mapping), GFP_KERNEL);
		if (map == NULL) {
		if (!map) {
			mutex_unlock(&q->vb_lock);
			mutex_unlock(&q->vb_lock);
			return -ENOMEM;
			return -ENOMEM;
		}
		}