OpenVZ Forum


Home » Mailing lists » Devel » [PATCH][IPVS] Relax the module get/put in ip_vs_app.c
[PATCH][IPVS] Relax the module get/put in ip_vs_app.c [message #23507] Mon, 19 November 2007 09:58 Go to previous message
Pavel Emelianov is currently offline  Pavel Emelianov
Messages: 1149
Registered: September 2006
Senior Member
Both try_module_get/module_put already handle the module == NULL
case, so no need in manual checking.

This patch fits both net-2.6 and net-2.6.25.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

---

diff --git a/net/ipv4/ipvs/ip_vs_app.c b/net/ipv4/ipvs/ip_vs_app.c
index 664cb8e..535abe0 100644
--- a/net/ipv4/ipvs/ip_vs_app.c
+++ b/net/ipv4/ipvs/ip_vs_app.c
@@ -51,18 +51,13 @@ static DEFINE_MUTEX(__ip_vs_app_mutex);
  */
 static inline int ip_vs_app_get(struct ip_vs_app *app)
 {
-	/* test and get the module atomically */
-	if (app->module)
-		return try_module_get(app->module);
-	else
-		return 1;
+	return try_module_get(app->module);
 }
 
 
 static inline void ip_vs_app_put(struct ip_vs_app *app)
 {
-	if (app->module)
-		module_put(app->module);
+	module_put(app->module);
 }
 
Read Message
Read Message
Read Message
Previous Topic: [PATCH][PKTGEN] Fix double unlock of xfrm_state->lock
Next Topic: [PATCH][net-2.6.25][NETNS] make netns cleanup to run in a separate workqueue
Goto Forum:
  


Current Time: Tue Aug 26 21:08:24 GMT 2025

Total time taken to generate the page: 0.15537 seconds