[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2ce8e183f03855af6c16b2a555473cca3fbbfef6.camel@gmail.com>
Date: Fri, 18 Dec 2020 19:57:55 +0100
From: Bean Huo <huobean@...il.com>
To: Adrian Hunter <adrian.hunter@...el.com>,
"Martin K . Petersen" <martin.petersen@...cle.com>,
"James E . J . Bottomley" <jejb@...ux.ibm.com>
Cc: linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
Alim Akhtar <alim.akhtar@...sung.com>,
Avri Altman <avri.altman@....com>,
Can Guo <cang@...eaurora.org>,
Stanley Chu <stanley.chu@...iatek.com>
Subject: Re: [PATCH V3] scsi: ufs-debugfs: Add error counters
On Fri, 2020-12-18 at 20:34 +0200, Adrian Hunter wrote:
> It is OK to pass NULL or error codes as parent dentry to
> debugfs_create_...
> functions.
>
> If ufs_debugfs_root is NULL (which won't happen) then the directory
> will be
> created in debugfs root i.e. /sys/kernel/debug, using the device
> name.
>
> If ufs_debugfs_root is an error code, then debugfs_create_dir will
> return an
> error code, and following debugfs_create_file() will return an error
> code.
>
> >
> > > + debugfs_create_file("stats", 0400, hba->debugfs_root, hba,
> > > &ufs_debugfs_stats_fops);
> >
> > if (!debugfs_create_file("stats", 0400, hba->debugfs_root,
> > hba,
> > &ufs_debugfs_stats_fops)) {
> > debugfs_remove(hba->debugfs_root);
> > return -ENOMEM;
>
> Being without debugfs files is not a problem, so there is no reason
> to
> return an error. It is relatively rare in the kernel that code
> checks the
> return value of debugfs_create_file(). We really don't want to fail
> probing
> just because of debugfs.
>
> However, because debugfs' only real resource is a small amount of
> memory, it
> is extremely unlikely it will fail in that sense. Although you can
> force it
> to fail by adding the kernel command line parameter debugfs=off
Adrian
Sounds your choice is correct. thanks.
Reviewed-by: Bean Huo <beanhuo@...ron.com>
Powered by blists - more mailing lists