Skip to contentSkip to conversation

staging: greybus: camera: simplify NULL test

PATCH New Eva Rachel Retuya 1 participant 1 message Sep 21, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: greybus: camera: simplify NULL test

Replace direct comparisons to NULL i.e. 'x == NULL' with '!x' for consistency. Coccinelle semantic patch used:

@@
identifier func;
expression x;
statement Z;
@@

x = func(...);

if (
(
+ !
x
- == NULL
|
+ !
- NULL ==
x
)
) Z

---
 drivers/staging/greybus/camera.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/greybus/camera.c +1 -1
index 46d2e8a..491bdd7 100644
@@ -1121,7 +1121,7 @@ static ssize_t gb_camera_debugfs_write(struct file *file,
 	       return -EINVAL;
 
 	kbuf = kmalloc(len + 1, GFP_KERNEL);
-	if (kbuf == NULL)
+	if (!kbuf)
 		return -ENOMEM;
 
 	if (copy_from_user(kbuf, buf, len)) {
Signature · 1 line
2.7.4