diff options
author | simran singhal <singhalsimran0@gmail.com> | 2017-03-04 22:16:54 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-03-09 14:27:13 +0100 |
commit | 4be4c379299e47ca00768f67ae47515ac74af3bd (patch) | |
tree | b5789f805b98b5799251a05e81394f235c71b841 /drivers/staging/speakup | |
parent | staging:speakup:i18n.c: Align open paranthesis (diff) | |
download | linux-dev-4be4c379299e47ca00768f67ae47515ac74af3bd.tar.xz linux-dev-4be4c379299e47ca00768f67ae47515ac74af3bd.zip |
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>
Diffstat (limited to 'drivers/staging/speakup')
-rw-r--r-- | drivers/staging/speakup/main.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c index 5c174c98f108..96e25eb631b5 100644 --- a/drivers/staging/speakup/main.c +++ b/drivers/staging/speakup/main.c @@ -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) |