From: Greg KH <gregkh@linuxfoundation.org>
To: Yicong Yang <yangyicong@hisilicon.com>
Cc: alexander.shishkin@linux.intel.com, helgaas@kernel.org,
linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
lorenzo.pieralisi@arm.com, jonathan.cameron@huawei.com,
song.bao.hua@hisilicon.com, prime.zeng@huawei.com,
linux-doc@vger.kernel.org, linuxarm@huawei.com
Subject: Re: [PATCH 1/4] hwtracing: Add trace function support for HiSilicon PCIe Tune and Trace device
Date: Tue, 6 Apr 2021 15:51:19 +0200 [thread overview]
Message-ID: <YGxnV163z9ptAN0B@kroah.com> (raw)
In-Reply-To: <1617713154-35533-2-git-send-email-yangyicong@hisilicon.com>
On Tue, Apr 06, 2021 at 08:45:51PM +0800, Yicong Yang wrote:
> +static int hisi_ptt_create_trace_entries(struct hisi_ptt *hisi_ptt)
> +{
> + struct hisi_ptt_debugfs_file_desc *trace_files;
> + struct dentry *dir;
> + int i, ret = 0;
> +
> + dir = debugfs_create_dir("trace", hisi_ptt->debugfs_dir);
> + if (IS_ERR(dir))
> + return PTR_ERR(dir);
No need to care about this, please do not check, code should not do
different things based on if debugfs is working or not.
> +
> + trace_files = devm_kmemdup(&hisi_ptt->pdev->dev, trace_entries,
> + sizeof(trace_entries), GFP_KERNEL);
> + if (IS_ERR(trace_files)) {
> + ret = PTR_ERR(trace_files);
> + goto err;
> + }
> +
> + for (i = 0; i < ARRAY_SIZE(trace_entries); ++i) {
> + struct dentry *file;
> +
> + trace_files[i].hisi_ptt = hisi_ptt;
> + file = debugfs_create_file(trace_files[i].name, 0600,
> + dir, &trace_files[i],
> + trace_files[i].fops);
> + if (IS_ERR(file)) {
> + ret = PTR_ERR(file);
Same here, why check?
> +static int hisi_ptt_register_debugfs(void)
> +{
> + if (!debugfs_initialized()) {
> + pr_err("failed to create debugfs directory: debugfs uninitialized\n");
Why do you care? How can this happen?
> + return -ENOENT;
> + }
> +
> + hisi_ptt_debugfs_root = debugfs_create_dir("hisi_ptt", NULL);
> + if (IS_ERR(hisi_ptt_debugfs_root)) {
Again, no need to check.
If you are building the whole functionality of your code on if debugfs
is working or not, that feels really wrong. Debugfs is for random
kernel debug type things, not a whole driver infrastructure that somehow
relies on it working or not.
thanks,
greg k-h
next prev parent reply other threads:[~2021-04-06 13:51 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-06 12:45 [PATCH 0/4] Add support for HiSilicon PCIe Tune and Trace device Yicong Yang
2021-04-06 12:45 ` [PATCH 1/4] hwtracing: Add trace function " Yicong Yang
2021-04-06 13:51 ` Greg KH [this message]
2021-04-06 16:14 ` kernel test robot
2021-04-06 22:48 ` kernel test robot
2021-04-06 12:45 ` [PATCH 2/4] hwtracing: Add tune " Yicong Yang
2021-04-06 12:45 ` [PATCH 3/4] docs: Add documentation for HiSilicon PTT device driver Yicong Yang
2021-04-07 18:55 ` Bjorn Helgaas
2021-04-08 13:22 ` Yicong Yang
2021-04-08 16:57 ` Bjorn Helgaas
2021-04-09 14:09 ` Yicong Yang
2021-04-06 12:45 ` [PATCH 4/4] MAINTAINERS: Add maintainer for HiSilicon PTT driver Yicong Yang
2021-04-06 13:49 ` [PATCH 0/4] Add support for HiSilicon PCIe Tune and Trace device Greg KH
2021-04-07 10:03 ` Yicong Yang
2021-04-07 10:25 ` Greg KH
2021-04-08 13:25 ` Yicong Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YGxnV163z9ptAN0B@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=helgaas@kernel.org \
--cc=jonathan.cameron@huawei.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=lorenzo.pieralisi@arm.com \
--cc=prime.zeng@huawei.com \
--cc=song.bao.hua@hisilicon.com \
--cc=yangyicong@hisilicon.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox