From: simran singhal Date: Sat, 4 Mar 2017 16:46:55 +0000 (+0530) Subject: staging: vc04_services: Clean up tests if NULL returned on failure X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6c849caf817da0c4e61003644043d55009114af8;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git staging: vc04_services: 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/vc04_services/interface/vchiq_arm/vchiq_util.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c index e0ba0ed704fd..7fa0310e7b9e 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c @@ -52,7 +52,7 @@ int vchiu_queue_init(VCHIU_QUEUE_T *queue, int size) sema_init(&queue->push, 0); queue->storage = kzalloc(size * sizeof(VCHIQ_HEADER_T *), GFP_KERNEL); - if (queue->storage == NULL) { + if (!queue->storage) { vchiu_queue_delete(queue); return 0; }