Thread (7 messages) read the whole thread 7 messages, 2 authors, 2017-03-29

Re: [PATCH v2] netfilter: Clean up tests if NULL returned on failure

From: Jan Engelhardt <hidden>
Date: 2017-03-28 14:04:28
Also in: lkml, lvs-devel, netfilter-devel

On Tuesday 2017-03-28 15:13, simran singhal wrote:
quoted hunk ↗ jump to hunk
Some functions like kmalloc/kzalloc return NULL on failure. When NULL
represents failure, !x is commonly used.
@@ -910,7 +910,7 @@ ip_vs_new_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest,
	}

	dest = kzalloc(sizeof(struct ip_vs_dest), GFP_KERNEL);
-	if (dest == NULL)
+	if (!dest)
		return -ENOMEM;
This kind of transformation however is not cleanup anymore, it's really 
bikeshedding and should be avoided. There are pro and cons for both 
variants, and there is not really an overwhelming number of arguments 
for either variant to justify the change.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help