Skip to contentSkip to conversation

namespace: Remove no longer needed goto label in the function, ops_init

PATCH Eric W. Biederman 1 participant 1 message May 29, 2015 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 4 lines · Nicholas Krause

This removes the no longer needed goto label, cleanup in the function ops_init due to kfree being NULL pointer safe and therefore no need to avoid calling it the call to kzalloc fails inside this particular function.

Your proposed change pessimizes the error path without a description of why that would be a benefit.

Further the subject on this patch is incorrect. You don't remove any gotos.

So I don't like this change as it. The description is wrong and the change provides little to no real world benefit.

Eric

Quoted 29 lines
---
 net/core/net_namespace.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
net/core/net_namespace.c +2 -4
index 572af00..e8b5568 100644
@@ -102,7 +102,7 @@ static int ops_init(const struct pernet_operations *ops, struct net *net)
 
 		err = net_assign_generic(net, *ops->id, data);
 		if (err)
-			goto cleanup;
+			goto out;
 	}
 	err = 0;
 	if (ops->init)
@@ -110,10 +110,8 @@ static int ops_init(const struct pernet_operations *ops, struct net *net)
 	if (!err)
 		return 0;
 
-cleanup:
-	kfree(data);
-
 out:
+	kfree(data);
 	return err;
 }