[PATCH net-next] can: avoid unnecessary remove in can_remove_proc

DORMANTno replies

From: YueHaibing <hidden>
Date: 2019-12-30 09:04:09
Also in: linux-can, lkml
Subsystem: can network layer, the rest · Maintainers: Oliver Hartkopp, Marc Kleine-Budde, Linus Torvalds

If net->can.proc_dir is null, there is no need to
do cleanup in can_remove_proc.

Signed-off-by: YueHaibing <redacted>
---
 net/can/proc.c | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/net/can/proc.c b/net/can/proc.c
index e6881bf..f84e977 100644
--- a/net/can/proc.c
+++ b/net/can/proc.c
@@ -471,6 +471,9 @@ void can_init_proc(struct net *net)
  */
 void can_remove_proc(struct net *net)
 {
+	if (!net->can.proc_dir)
+		return;
+
 	if (net->can.pde_version)
 		remove_proc_entry(CAN_PROC_VERSION, net->can.proc_dir);
 
-- 
2.7.4

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help