diff mbox series

[1/2] ASoC: core: Adapt for debugfs API change

Message ID 20190621113357.8264-1-broonie@kernel.org
State Accepted
Commit c2c928c93173f220955030e8440517b87ec7df92
Headers show
Series [1/2] ASoC: core: Adapt for debugfs API change | expand

Commit Message

Mark Brown June 21, 2019, 11:33 a.m. UTC
Back in ff9fb72bc07705c (debugfs: return error values, not NULL) the
debugfs APIs were changed to return error pointers rather than NULL
pointers on error, breaking the error checking in ASoC. Update the
code to use IS_ERR() and log the codes that are returned as part of
the error messages.

Fixes: ff9fb72bc07705c (debugfs: return error values, not NULL)
Signed-off-by: Mark Brown <broonie@kernel.org>

Cc: stable@vger.kernel.org
---
 sound/soc/soc-core.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

-- 
2.20.1

Comments

Greg KH June 21, 2019, 1:20 p.m. UTC | #1
On Fri, Jun 21, 2019 at 12:33:56PM +0100, Mark Brown wrote:
> Back in ff9fb72bc07705c (debugfs: return error values, not NULL) the

> debugfs APIs were changed to return error pointers rather than NULL

> pointers on error, breaking the error checking in ASoC. Update the

> code to use IS_ERR() and log the codes that are returned as part of

> the error messages.

> 

> Fixes: ff9fb72bc07705c (debugfs: return error values, not NULL)

> Signed-off-by: Mark Brown <broonie@kernel.org>

> Cc: stable@vger.kernel.org

> ---

>  sound/soc/soc-core.c | 16 ++++++++++------

>  1 file changed, 10 insertions(+), 6 deletions(-)

> 

> diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c

> index c510da2d4af6..6d5c09493f4b 100644

> --- a/sound/soc/soc-core.c

> +++ b/sound/soc/soc-core.c

> @@ -165,9 +165,10 @@ static void soc_init_component_debugfs(struct snd_soc_component *component)

>  				component->card->debugfs_card_root);

>  	}

>  

> -	if (!component->debugfs_root) {

> +	if (IS_ERR(component->debugfs_root)) {

>  		dev_warn(component->dev,

> -			"ASoC: Failed to create component debugfs directory\n");

> +			"ASoC: Failed to create component debugfs directory: %ld\n",

> +			PTR_ERR(component->debugfs_root));


Why warn on this?  You will _never_ see this message :)

>  		return;

>  	}

>  

> @@ -219,18 +220,21 @@ static void soc_init_card_debugfs(struct snd_soc_card *card)

>  

>  	card->debugfs_card_root = debugfs_create_dir(card->name,

>  						     snd_soc_debugfs_root);

> -	if (!card->debugfs_card_root) {

> +	if (IS_ERR(card->debugfs_card_root)) {

>  		dev_warn(card->dev,

> -			 "ASoC: Failed to create card debugfs directory\n");

> +			 "ASoC: Failed to create card debugfs directory: %ld\n",

> +			 PTR_ERR(card->debugfs_card_root));

> +		card->debugfs_card_root = NULL;


Same here.

And keep card->debugfs_card_root to be the error pointer, that way no
further files are created for that directory.

thanks,

greg k-h
diff mbox series

Patch

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index c510da2d4af6..6d5c09493f4b 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -165,9 +165,10 @@  static void soc_init_component_debugfs(struct snd_soc_component *component)
 				component->card->debugfs_card_root);
 	}
 
-	if (!component->debugfs_root) {
+	if (IS_ERR(component->debugfs_root)) {
 		dev_warn(component->dev,
-			"ASoC: Failed to create component debugfs directory\n");
+			"ASoC: Failed to create component debugfs directory: %ld\n",
+			PTR_ERR(component->debugfs_root));
 		return;
 	}
 
@@ -219,18 +220,21 @@  static void soc_init_card_debugfs(struct snd_soc_card *card)
 
 	card->debugfs_card_root = debugfs_create_dir(card->name,
 						     snd_soc_debugfs_root);
-	if (!card->debugfs_card_root) {
+	if (IS_ERR(card->debugfs_card_root)) {
 		dev_warn(card->dev,
-			 "ASoC: Failed to create card debugfs directory\n");
+			 "ASoC: Failed to create card debugfs directory: %ld\n",
+			 PTR_ERR(card->debugfs_card_root));
+		card->debugfs_card_root = NULL;
 		return;
 	}
 
 	card->debugfs_pop_time = debugfs_create_u32("dapm_pop_time", 0644,
 						    card->debugfs_card_root,
 						    &card->pop_time);
-	if (!card->debugfs_pop_time)
+	if (IS_ERR(card->debugfs_pop_time))
 		dev_warn(card->dev,
-			 "ASoC: Failed to create pop time debugfs file\n");
+			 "ASoC: Failed to create pop time debugfs file: %ld\n",
+			 PTR_ERR(card->debugfs_pop_time));
 }
 
 static void soc_cleanup_card_debugfs(struct snd_soc_card *card)