From: Takashi Iwai <tiwai@suse.de>
To: Ruan Jinjie <ruanjinjie@huawei.com>
Cc: <alsa-devel@alsa-project.org>,
Ivan Orlov <ivan.orlov0322@gmail.com>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>
Subject: Re: [PATCH -next] ALSA: pcmtest: Drop unnecessary error check for debugfs_create_dir
Date: Thu, 17 Aug 2023 08:47:03 +0200 [thread overview]
Message-ID: <87bkf6w4go.wl-tiwai@suse.de> (raw)
In-Reply-To: <20230817063922.282746-1-ruanjinjie@huawei.com>
On Thu, 17 Aug 2023 08:39:22 +0200,
Ruan Jinjie wrote:
>
> This patch removes the error checking for debugfs_create_dir in
> pcmtest.c. This is because the DebugFS kernel API is developed
> in a way that the caller can safely ignore the errors that
> occur during the creation of DebugFS nodes. The debugfs APIs have
> a IS_ERR() judge in start_creating() which can handle it
> gracefully. So these checks are unnecessary.
>
> Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
I believe debugfs is mandatory in this case (it's a test module that
manipulates / gets notification via debugfs), hence it makes sense to
check the error.
Maybe we should add a dependency on CONFIG_DEBUG_FS in Kconfig?
thanks,
Takashi
> ---
> sound/drivers/pcmtest.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/sound/drivers/pcmtest.c b/sound/drivers/pcmtest.c
> index 7f170429eb8f..9360b3bb771e 100644
> --- a/sound/drivers/pcmtest.c
> +++ b/sound/drivers/pcmtest.c
> @@ -669,8 +669,6 @@ static int init_debug_files(int buf_count)
> char len_file_name[32];
>
> driver_debug_dir = debugfs_create_dir("pcmtest", NULL);
> - if (IS_ERR(driver_debug_dir))
> - return PTR_ERR(driver_debug_dir);
> debugfs_create_u8("pc_test", 0444, driver_debug_dir, &playback_capture_test);
> debugfs_create_u8("ioctl_test", 0444, driver_debug_dir, &ioctl_reset_test);
>
> --
> 2.34.1
>
next prev parent reply other threads:[~2023-08-17 6:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-17 6:39 [PATCH -next] ALSA: pcmtest: Drop unnecessary error check for debugfs_create_dir Ruan Jinjie
2023-08-17 6:47 ` Takashi Iwai [this message]
2023-08-17 7:03 ` Ruan Jinjie
2023-08-17 8:30 ` Ivan Orlov
2023-08-17 8:33 ` Ruan Jinjie
2023-08-17 8:40 ` Ivan Orlov
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=87bkf6w4go.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=ivan.orlov0322@gmail.com \
--cc=perex@perex.cz \
--cc=ruanjinjie@huawei.com \
--cc=tiwai@suse.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