Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp2015437ybh; Tue, 14 Jul 2020 13:13:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyc632anZcZPhgjU/Y+D4k5OithQ6Qk6qpT3AKVyn7Bf0ES1eSmoP9QJTKJo4CMbRJT2hOS X-Received: by 2002:a17:906:c102:: with SMTP id do2mr5871389ejc.126.1594757624991; Tue, 14 Jul 2020 13:13:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594757624; cv=none; d=google.com; s=arc-20160816; b=IdyMsL/ZvXymOHU5YYmyQn1NzhqHfL6VWJPrSaWns6lKBX1WTLa/+wTufXFTg9bH01 0Twp4A2O2g56coLZr60ftwGEmrMlRusEttMaerphbzxujJ61xbGwrh+UeMHOgBcidHqk z1Enc7PEMvWHSKU26Oq8ihmZIZOgct4xp/wcmTyVCWqoh8D0sNemZ7xv8YjsqUbG6szC pf2GIofy1+/VikZlNNjFpN4/mcmr+Fa/CDBRe7MaV6aAf1BkjRP2KinsVynC1sxoaDtq 8jhwVghAX4iP3GR1rY6pm/h51Y3U7HbzA6PJIzlnk7S9ez9Zbj9skH2UZ+zl8uSzWb4h CMuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=GNcdh9hbyCSYCE1dhM3aHIwRYOjxxn/mU4RGqzYVsko=; b=nhLHhhaoor8xQ71xOcw8QVvtcxfLkYefMSLISo8OMmDT4H9IOEeEixTtygiKP28TVm JmwPOfJwzYgcjgf8U1Bm60xOvWpJ+Ykkg85SZB/OMVf8NVR8pPXSkwH/fOSaXLthJVnp 6xxt+KFuzShJ70iRy3YU5sSJz37qr5+CU6xs+/AB7YAvmg+pqDXnPWWL+0hOMsf25hWM c1b7b3iD/wAG5gQ8O6QG/9IxrHL0i3MuruqPUSjS+ihIeh7LTfrFU2NPRgvZMTDH/6DT 4UM5Qmmf40n0VlmAPnvOe6UyfRW840i2Tgm1bSEE10ooZxS8tLlcB749OXglp466QZFe FraA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@hartkopp.net header.s=strato-dkim-0002 header.b=hvMq0Ftj; 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 bg25si11770330ejb.230.2020.07.14.13.13.21; Tue, 14 Jul 2020 13:13:44 -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; dkim=fail header.i=@hartkopp.net header.s=strato-dkim-0002 header.b=hvMq0Ftj; 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 S1728100AbgGNUKc (ORCPT + 99 others); Tue, 14 Jul 2020 16:10:32 -0400 Received: from mo4-p01-ob.smtp.rzone.de ([81.169.146.166]:20786 "EHLO mo4-p01-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725945AbgGNUKb (ORCPT ); Tue, 14 Jul 2020 16:10:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1594757429; s=strato-dkim-0002; d=hartkopp.net; h=In-Reply-To:Date:Message-ID:From:References:Cc:To:Subject: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=GNcdh9hbyCSYCE1dhM3aHIwRYOjxxn/mU4RGqzYVsko=; b=hvMq0FtjXZ4ja0TuywxipPbO7azfGxH7OjuTLXyy6VhFPRT4qrOdDkKAsMlFVdtFq9 YT9PNq2F/LNh8bzxKgp5CQ5MNp+xONj78Vt59maynjmADTgIY8ZqoFuIWfFzCYH7mTme CCXyAcxzAyuUia3pDuzOvJ8/e0DpQ7wV/gxIfCwxXsPPzWWBaNPZ7j+43SlV4yJPQEbw F9a8IUc93tDHcIoNPoIbhxn5HR5pIKA7yQChmlxvyZB7xL8k6l14C4Rd6FfyP70HV4x/ v0ZlwWd3N7PTJlplBuTmU/FN6oHzbIcyrcraE5MH9/87eqp4j2OAKvVgPqswJDSitneJ m8bQ== X-RZG-AUTH: ":P2MHfkW8eP4Mre39l357AZT/I7AY/7nT2yrDxb8mjG14FZxedJy6qgO1o3HMbEWKOdeVTdI=" X-RZG-CLASS-ID: mo00 Received: from [192.168.50.177] by smtp.strato.de (RZmta 46.10.5 DYNA|AUTH) with ESMTPSA id R09ac6w6EKA9tgs (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Tue, 14 Jul 2020 22:10:09 +0200 (CEST) Subject: Re: [PATCH net-next] can: silence remove_proc_entry warning To: Zhang Changzhong , mkl@pengutronix.de, davem@davemloft.net, kuba@kernel.org Cc: linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <1594709090-3203-1-git-send-email-zhangchangzhong@huawei.com> From: Oliver Hartkopp Message-ID: Date: Tue, 14 Jul 2020 22:10:04 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <1594709090-3203-1-git-send-email-zhangchangzhong@huawei.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 14.07.20 08:44, Zhang Changzhong wrote: > 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 Acked-by: Oliver Hartkopp Thanks! > --- > 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); > } >