public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: soc-core: Fix checking return value of debugfs_create_dir
@ 2011-08-14  3:23 Axel Lin
  2011-08-14  4:28 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2011-08-14  3:23 UTC (permalink / raw)
  To: linux-kernel; +Cc: Liam Girdwood, Mark Brown, alsa-devel

We have CONFIG_DEBUG_FS guard around the place calling debugfs_create_dir,
thus debugfs_create_dir returns NULL on failure.

Also use pr_warn to print the warning.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 sound/soc/soc-core.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index ae93aa8..69d17ec 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3356,11 +3356,8 @@ static int __init snd_soc_init(void)
 {
 #ifdef CONFIG_DEBUG_FS
 	snd_soc_debugfs_root = debugfs_create_dir("asoc", NULL);
-	if (IS_ERR(snd_soc_debugfs_root) || !snd_soc_debugfs_root) {
-		printk(KERN_WARNING
-		       "ASoC: Failed to create debugfs directory\n");
-		snd_soc_debugfs_root = NULL;
-	}
+	if (!snd_soc_debugfs_root)
+		pr_warn("ASoC: Failed to create debugfs directory\n");
 
 	if (!debugfs_create_file("codecs", 0444, snd_soc_debugfs_root, NULL,
 				 &codec_list_fops))
-- 
1.7.4.1




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ASoC: soc-core: Fix checking return value of debugfs_create_dir
  2011-08-14  3:23 [PATCH] ASoC: soc-core: Fix checking return value of debugfs_create_dir Axel Lin
@ 2011-08-14  4:28 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2011-08-14  4:28 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Liam Girdwood, alsa-devel

On Sun, Aug 14, 2011 at 11:23:13AM +0800, Axel Lin wrote:
> We have CONFIG_DEBUG_FS guard around the place calling debugfs_create_dir,
> thus debugfs_create_dir returns NULL on failure.

On the other hand the existing code doesn't actually have any problem,
the IS_ERR() won't give false positives, so the changelog isn't really
accurate and if anything we'll introduce a bug if someone cut'n'pastes
the code elsewhere.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-08-14  4:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-14  3:23 [PATCH] ASoC: soc-core: Fix checking return value of debugfs_create_dir Axel Lin
2011-08-14  4:28 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox