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@xxxxxxxxxx>