[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1488646015-7059-4-git-send-email-singhalsimran0@gmail.com>
Date: Sat, 4 Mar 2017 22:16:55 +0530
From: simran singhal <singhalsimran0@...il.com>
To: w.d.hubbs@...il.com
Cc: chris@...-brannons.com, gregkh@...uxfoundation.org,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org,
speakup@...ux-speakup.org, linux-rpi-kernel@...ts.infradead.org,
outreachy-kernel@...glegroups.com,
linux-arm-kernel@...ts.infradead.org
Subject: [PATCH 3/3] 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 <singhalsimran0@...il.com>
---
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 e0ba0ed..7fa0310 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;
}
--
2.7.4
Powered by blists - more mailing lists