From: simran singhal Date: Sat, 4 Mar 2017 16:46:54 +0000 (+0530) Subject: staging: speakup: Clean up tests if NULL returned on failure X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4be4c379299e47ca00768f67ae47515ac74af3bd;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git 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 Acked-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman --- 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)