Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1533749ybh; Mon, 13 Jul 2020 23:45:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/gKKK4NicwzuQtp348TU6oBOP1qk4isRsTdvdDQFtbUiuMj9lup7Esz5xTUQwusQyF+yK X-Received: by 2002:a17:906:c259:: with SMTP id bl25mr3145084ejb.303.1594709146414; Mon, 13 Jul 2020 23:45:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594709146; cv=none; d=google.com; s=arc-20160816; b=M15Lcv6mroaN/bVUqgipK9UMvY6jhdS5+Uf7ms+wdENftoVkEt5va+HUCIcK3Cvbpn sXFdnU9LfMwHEc9vlrCrwgozBUAxu1kfppQ7K5AGvz1wZYTna3UTZ+PvhIfsY+3Pu1l/ 7p7O4Se5HFfgjvedBVOsAKshaRurGXpBSTJcjRIj2ulj0S3rYC5F+Ny4KwVmg/HquRvt F9gDzwoA7W/G93nhHY75bDmsPnKjcRW+yI3BOhB/8Avwkbim1FWgb8F+2jTNaY+qmQH7 mYYs75PjmBCQCULQgXxEqIjLOPMd2MZm2Gr2KtXWASflTEuBhRCXH77QPGan3/uF8cfX C/dA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=nCgJE6lUeL3/T1/YpR3TP64WFj+T3DyhxGmCIY6sT5g=; b=Os5MUJck2QD4ng6pWVPyh4O11NP0eEBYzJDDdAC8RV3bWRa4MZlYewqMk2UOkWLYKR hGjEL2MlL8u3TtgoaEo348VCR0VtQGZ4PTInFO91uEa3s2gkOda7wqGETpqPFqVEiAbR WpgsEXZvMQkXAJJsjXWOFLWzPr9LQILLJvgxgxfNYeb+WSSKNHMGsrsHAP1dscigATNu fUJzCti/99TUtQ0j660mz8G2HeJPvnB5qUhe1xGnJORYQv34qTt4e/eOX7c+vFkurg+3 iJNnbL985ajW2+s6nK5rNxlAu72/FyLRiL7W/xcBdmGJtOxJbgeI2A/sBO+RWLGOh+6W tJSA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c16si10195547ejb.57.2020.07.13.23.45.23; Mon, 13 Jul 2020 23:45:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726770AbgGNGpN (ORCPT + 99 others); Tue, 14 Jul 2020 02:45:13 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:51410 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726375AbgGNGpM (ORCPT ); Tue, 14 Jul 2020 02:45:12 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id A34E061132CB930F3ED4; Tue, 14 Jul 2020 14:45:08 +0800 (CST) Received: from localhost.localdomain (10.175.112.70) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server (TLS) id 14.3.487.0; Tue, 14 Jul 2020 14:45:04 +0800 From: Zhang Changzhong To: , , , CC: , , Subject: [PATCH net-next] can: silence remove_proc_entry warning Date: Tue, 14 Jul 2020 14:44:50 +0800 Message-ID: <1594709090-3203-1-git-send-email-zhangchangzhong@huawei.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.112.70] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If can_init_proc() fail to create /proc/net/can directory, can_remove_proc() will trigger a warning: WARNING: CPU: 6 PID: 7133 at fs/proc/generic.c:672 remove_proc_entry+0x17b0 Kernel panic - not syncing: panic_on_warn set ... Fix to return early from can_remove_proc() if can proc_dir does not exists. Signed-off-by: Zhang Changzhong --- net/can/proc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/can/proc.c b/net/can/proc.c index e6881bf..077af42 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); @@ -498,6 +501,5 @@ void can_remove_proc(struct net *net) if (net->can.pde_rcvlist_sff) remove_proc_entry(CAN_PROC_RCVLIST_SFF, net->can.proc_dir); - if (net->can.proc_dir) - remove_proc_entry("can", net->proc_net); + remove_proc_entry("can", net->proc_net); } -- 1.8.3.1