diff mbox series

[3/5] sound: soc: codecs: wm_adsp: no need to check return value of debugfs_create functions

Message ID 20190614094756.2965-3-gregkh@linuxfoundation.org (mailing list archive)
State Accepted
Commit 7f807f280964e31fb32fe6aaa263cfa2488236d8
Headers show
Series [1/5] sound: SoC: sof: no need to check return value of debugfs_create functions | expand

Commit Message

Greg Kroah-Hartman June 14, 2019, 9:47 a.m. UTC
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: <patches@opensource.cirrus.com>
Cc: <alsa-devel@alsa-project.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 sound/soc/codecs/wm_adsp.c | 37 +++++++------------------------------
 1 file changed, 7 insertions(+), 30 deletions(-)

Comments

Richard Fitzgerald June 14, 2019, 10:24 a.m. UTC | #1
On 14/06/19 10:47, Greg Kroah-Hartman wrote:
> When calling debugfs functions, there is no need to ever check the
> return value.  The function can work or not, but the code logic should
> never do something different based on this.
> 
> Cc: Liam Girdwood <lgirdwood@gmail.com>
> Cc: Mark Brown <broonie@kernel.org>
> Cc: Jaroslav Kysela <perex@perex.cz>
> Cc: Takashi Iwai <tiwai@suse.com>
> Cc: <patches@opensource.cirrus.com>
> Cc: <alsa-devel@alsa-project.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>   sound/soc/codecs/wm_adsp.c | 37 +++++++------------------------------
>   1 file changed, 7 insertions(+), 30 deletions(-)
> 
> diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
> index b26e6b825a90..8f301cb07745 100644
> --- a/sound/soc/codecs/wm_adsp.c
> +++ b/sound/soc/codecs/wm_adsp.c
> @@ -731,41 +731,18 @@ static void wm_adsp2_init_debugfs(struct wm_adsp *dsp,
>   	struct dentry *root = NULL;
>   	int i;
>   
> -	if (!component->debugfs_root) {
> -		adsp_err(dsp, "No codec debugfs root\n");
> -		goto err;
> -	}
> -
>   	root = debugfs_create_dir(dsp->name, component->debugfs_root);
>   
> -	if (!root)
> -		goto err;
> -
> -	if (!debugfs_create_bool("booted", 0444, root, &dsp->booted))
> -		goto err;
> +	debugfs_create_bool("booted", 0444, root, &dsp->booted);
> +	debugfs_create_bool("running", 0444, root, &dsp->running);
> +	debugfs_create_x32("fw_id", 0444, root, &dsp->fw_id);
> +	debugfs_create_x32("fw_version", 0444, root, &dsp->fw_id_version);
>   
> -	if (!debugfs_create_bool("running", 0444, root, &dsp->running))
> -		goto err;
> -
> -	if (!debugfs_create_x32("fw_id", 0444, root, &dsp->fw_id))
> -		goto err;
> -
> -	if (!debugfs_create_x32("fw_version", 0444, root, &dsp->fw_id_version))
> -		goto err;
> -
> -	for (i = 0; i < ARRAY_SIZE(wm_adsp_debugfs_fops); ++i) {
> -		if (!debugfs_create_file(wm_adsp_debugfs_fops[i].name,
> -					 0444, root, dsp,
> -					 &wm_adsp_debugfs_fops[i].fops))
> -			goto err;
> -	}
> +	for (i = 0; i < ARRAY_SIZE(wm_adsp_debugfs_fops); ++i)
> +		debugfs_create_file(wm_adsp_debugfs_fops[i].name, 0444, root,
> +				    dsp, &wm_adsp_debugfs_fops[i].fops);
>   
>   	dsp->debugfs_root = root;
> -	return;
> -
> -err:
> -	debugfs_remove_recursive(root);
> -	adsp_err(dsp, "Failed to create debugfs\n");
>   }
>   
>   static void wm_adsp2_cleanup_debugfs(struct wm_adsp *dsp)
> 

Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com>
diff mbox series

Patch

diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index b26e6b825a90..8f301cb07745 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -731,41 +731,18 @@  static void wm_adsp2_init_debugfs(struct wm_adsp *dsp,
 	struct dentry *root = NULL;
 	int i;
 
-	if (!component->debugfs_root) {
-		adsp_err(dsp, "No codec debugfs root\n");
-		goto err;
-	}
-
 	root = debugfs_create_dir(dsp->name, component->debugfs_root);
 
-	if (!root)
-		goto err;
-
-	if (!debugfs_create_bool("booted", 0444, root, &dsp->booted))
-		goto err;
+	debugfs_create_bool("booted", 0444, root, &dsp->booted);
+	debugfs_create_bool("running", 0444, root, &dsp->running);
+	debugfs_create_x32("fw_id", 0444, root, &dsp->fw_id);
+	debugfs_create_x32("fw_version", 0444, root, &dsp->fw_id_version);
 
-	if (!debugfs_create_bool("running", 0444, root, &dsp->running))
-		goto err;
-
-	if (!debugfs_create_x32("fw_id", 0444, root, &dsp->fw_id))
-		goto err;
-
-	if (!debugfs_create_x32("fw_version", 0444, root, &dsp->fw_id_version))
-		goto err;
-
-	for (i = 0; i < ARRAY_SIZE(wm_adsp_debugfs_fops); ++i) {
-		if (!debugfs_create_file(wm_adsp_debugfs_fops[i].name,
-					 0444, root, dsp,
-					 &wm_adsp_debugfs_fops[i].fops))
-			goto err;
-	}
+	for (i = 0; i < ARRAY_SIZE(wm_adsp_debugfs_fops); ++i)
+		debugfs_create_file(wm_adsp_debugfs_fops[i].name, 0444, root,
+				    dsp, &wm_adsp_debugfs_fops[i].fops);
 
 	dsp->debugfs_root = root;
-	return;
-
-err:
-	debugfs_remove_recursive(root);
-	adsp_err(dsp, "Failed to create debugfs\n");
 }
 
 static void wm_adsp2_cleanup_debugfs(struct wm_adsp *dsp)