OSDN Git Service

staging: speakup: Clean up tests if NULL returned on failure
authorsimran singhal <singhalsimran0@gmail.com>
Sat, 4 Mar 2017 16:46:54 +0000 (22:16 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Mar 2017 13:27:13 +0000 (14:27 +0100)
commit4be4c379299e47ca00768f67ae47515ac74af3bd
treeb5789f805b98b5799251a05e81394f235c71b841
parent1839f03706d6f0f196bb15b1f99c4a5fe76a829e
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: simran singhal <singhalsimran0@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/speakup/main.c