[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20191230090333.20664-1-yuehaibing@huawei.com>
Date:   Mon, 30 Dec 2019 17:03:33 +0800
From:   YueHaibing <yuehaibing@...wei.com>
To:     <socketcan@...tkopp.net>, <mkl@...gutronix.de>,
        <davem@...emloft.net>
CC:     <linux-can@...r.kernel.org>, <netdev@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>, YueHaibing <yuehaibing@...wei.com>
Subject: [PATCH net-next] can: avoid unnecessary remove in can_remove_proc
If net->can.proc_dir is null, there is no need to
do cleanup in can_remove_proc.
Signed-off-by: YueHaibing <yuehaibing@...wei.com>
---
 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
Powered by blists - more mailing lists
 
