diff mbox

[v2,2/2] ASoC: soc-core: Remove unneeded error check

Message ID 1502075814-23766-2-git-send-email-festevam@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Fabio Estevam Aug. 7, 2017, 3:16 a.m. UTC
debugfs_create_dir() only returns an error pointer when kernel has been
built without debugfs support.
Quoting Documentation/filesystems/debugfs.txt:

"A NULL return value indicates that something went
wrong.  If ERR_PTR(-ENODEV) is returned, that is an indication that the
kernel has been built without debugfs support and none of the functions
described below will work."

As snd_soc_debugfs_init() is only defined when CONFIG_DEBUG_FS=y,
there is no possibility for debugfs_create_dir() returning an error,
so remove the unneeded error check.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
Changes since v1:
- Remove uneeded 'snd_soc_debugfs_root = NULL;' assignment

 sound/soc/soc-core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Mark Brown Aug. 7, 2017, 11:31 a.m. UTC | #1
On Mon, Aug 07, 2017 at 12:16:54AM -0300, Fabio Estevam wrote:

> "A NULL return value indicates that something went
> wrong.  If ERR_PTR(-ENODEV) is returned, that is an indication that the
> kernel has been built without debugfs support and none of the functions
> described below will work."

> As snd_soc_debugfs_init() is only defined when CONFIG_DEBUG_FS=y,
> there is no possibility for debugfs_create_dir() returning an error,
> so remove the unneeded error check.

Removing the error handling means that if in future it does start
returning errors we'll ignore them - it's not like the error handling is
getting in the way or otherwise causing problems, removing it isn't
making things better.
diff mbox

Patch

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index e93a72c..4edd00a 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -495,9 +495,8 @@  static void soc_cleanup_card_debugfs(struct snd_soc_card *card)
 static void snd_soc_debugfs_init(void)
 {
 	snd_soc_debugfs_root = debugfs_create_dir("asoc", NULL);
-	if (IS_ERR(snd_soc_debugfs_root) || !snd_soc_debugfs_root) {
+	if (!snd_soc_debugfs_root) {
 		pr_warn("ASoC: Failed to create debugfs directory\n");
-		snd_soc_debugfs_root = NULL;
 		return;
 	}