From 9573878611f4dd4d7be2e649814bef3270f4e5bd Mon Sep 17 00:00:00 2001 From: simran singhal Date: Fri, 10 Mar 2017 10:43:10 +0530 Subject: [PATCH] staging: atomisp_fops: 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 Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c index 20e581e5a94b..e5a7407bf7ab 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c @@ -1100,7 +1100,7 @@ int atomisp_videobuf_mmap_mapper(struct videobuf_queue *q, continue; map = kzalloc(sizeof(struct videobuf_mapping), GFP_KERNEL); - if (map == NULL) { + if (!map) { mutex_unlock(&q->vb_lock); return -ENOMEM; } -- 2.30.2