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

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

staging: speakup: 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>
Acked-by: default avatarJulia Lawall <julia.lawall@lip6.fr>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1839f037
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1324,7 +1324,7 @@ static int speakup_allocate(struct vc_data *vc)
	if (speakup_console[vc_num] == NULL) {
		speakup_console[vc_num] = kzalloc(sizeof(*speakup_console[0]),
						  GFP_ATOMIC);
		if (speakup_console[vc_num] == NULL)
		if (!speakup_console[vc_num])
			return -ENOMEM;
		speakup_date(vc);
	} else if (!spk_parked)