stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] ASoC: core: Adapt for debugfs API change
@ 2019-06-21 11:33 Mark Brown
  2019-06-21 11:33 ` [PATCH 2/2] ASoC: dapm: " Mark Brown
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Mark Brown @ 2019-06-21 11:33 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: alsa-devel, Mark Brown, stable

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));
 		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)
-- 
2.20.1


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

* [PATCH 2/2] ASoC: dapm: Adapt for debugfs API change
  2019-06-21 11:33 [PATCH 1/2] ASoC: core: Adapt for debugfs API change Mark Brown
@ 2019-06-21 11:33 ` Mark Brown
  2019-06-21 13:22   ` Greg KH
  2019-06-24 16:32   ` Applied "ASoC: dapm: Adapt for debugfs API change" to the asoc tree Mark Brown
  2019-06-21 13:20 ` [PATCH 1/2] ASoC: core: Adapt for debugfs API change Greg KH
  2019-06-24 16:32 ` Applied "ASoC: core: Adapt for debugfs API change" to the asoc tree Mark Brown
  2 siblings, 2 replies; 9+ messages in thread
From: Mark Brown @ 2019-06-21 11:33 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: alsa-devel, Mark Brown, stable

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-dapm.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 6b44b4a78b8e..f013b24c050a 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -2156,23 +2156,25 @@ void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm,
 {
 	struct dentry *d;
 
-	if (!parent)
+	if (!parent || IS_ERR(parent))
 		return;
 
 	dapm->debugfs_dapm = debugfs_create_dir("dapm", parent);
 
-	if (!dapm->debugfs_dapm) {
+	if (IS_ERR(dapm->debugfs_dapm)) {
 		dev_warn(dapm->dev,
-		       "ASoC: Failed to create DAPM debugfs directory\n");
+			 "ASoC: Failed to create DAPM debugfs directory %ld\n",
+			 PTR_ERR(dapm->debugfs_dapm));
 		return;
 	}
 
 	d = debugfs_create_file("bias_level", 0444,
 				dapm->debugfs_dapm, dapm,
 				&dapm_bias_fops);
-	if (!d)
+	if (IS_ERR(d))
 		dev_warn(dapm->dev,
-			 "ASoC: Failed to create bias level debugfs file\n");
+			 "ASoC: Failed to create bias level debugfs file: %ld\n",
+			 PTR_ERR(d));
 }
 
 static void dapm_debugfs_add_widget(struct snd_soc_dapm_widget *w)
@@ -2186,10 +2188,10 @@ static void dapm_debugfs_add_widget(struct snd_soc_dapm_widget *w)
 	d = debugfs_create_file(w->name, 0444,
 				dapm->debugfs_dapm, w,
 				&dapm_widget_power_fops);
-	if (!d)
+	if (IS_ERR(d))
 		dev_warn(w->dapm->dev,
-			"ASoC: Failed to create %s debugfs file\n",
-			w->name);
+			 "ASoC: Failed to create %s debugfs file: %ld\n",
+			 w->name, PTR_ERR(d));
 }
 
 static void dapm_debugfs_cleanup(struct snd_soc_dapm_context *dapm)
-- 
2.20.1


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

* Re: [PATCH 1/2] ASoC: core: Adapt for debugfs API change
  2019-06-21 11:33 [PATCH 1/2] ASoC: core: Adapt for debugfs API change Mark Brown
  2019-06-21 11:33 ` [PATCH 2/2] ASoC: dapm: " Mark Brown
@ 2019-06-21 13:20 ` Greg KH
  2019-06-24 16:32 ` Applied "ASoC: core: Adapt for debugfs API change" to the asoc tree Mark Brown
  2 siblings, 0 replies; 9+ messages in thread
From: Greg KH @ 2019-06-21 13:20 UTC (permalink / raw)
  To: Mark Brown; +Cc: Liam Girdwood, alsa-devel, stable

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

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

* Re: [PATCH 2/2] ASoC: dapm: Adapt for debugfs API change
  2019-06-21 11:33 ` [PATCH 2/2] ASoC: dapm: " Mark Brown
@ 2019-06-21 13:22   ` Greg KH
  2019-06-21 14:30     ` Mark Brown
  2019-06-24 16:32   ` Applied "ASoC: dapm: Adapt for debugfs API change" to the asoc tree Mark Brown
  1 sibling, 1 reply; 9+ messages in thread
From: Greg KH @ 2019-06-21 13:22 UTC (permalink / raw)
  To: Mark Brown; +Cc: Liam Girdwood, alsa-devel, stable

On Fri, Jun 21, 2019 at 12:33:57PM +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-dapm.c | 18 ++++++++++--------
>  1 file changed, 10 insertions(+), 8 deletions(-)
> 
> diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
> index 6b44b4a78b8e..f013b24c050a 100644
> --- a/sound/soc/soc-dapm.c
> +++ b/sound/soc/soc-dapm.c
> @@ -2156,23 +2156,25 @@ void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm,
>  {
>  	struct dentry *d;
>  
> -	if (!parent)
> +	if (!parent || IS_ERR(parent))
>  		return;

How can parent be NULL?

>  
>  	dapm->debugfs_dapm = debugfs_create_dir("dapm", parent);
>  
> -	if (!dapm->debugfs_dapm) {
> +	if (IS_ERR(dapm->debugfs_dapm)) {
>  		dev_warn(dapm->dev,
> -		       "ASoC: Failed to create DAPM debugfs directory\n");
> +			 "ASoC: Failed to create DAPM debugfs directory %ld\n",
> +			 PTR_ERR(dapm->debugfs_dapm));

Same comment as before, no need to print anything.

>  		return;
>  	}
>  
>  	d = debugfs_create_file("bias_level", 0444,
>  				dapm->debugfs_dapm, dapm,
>  				&dapm_bias_fops);
> -	if (!d)
> +	if (IS_ERR(d))
>  		dev_warn(dapm->dev,
> -			 "ASoC: Failed to create bias level debugfs file\n");
> +			 "ASoC: Failed to create bias level debugfs file: %ld\n",
> +			 PTR_ERR(d));

Again, no need to warn, no one will see it :)

I am trying to make it so that debugfs doesn't return anything for when
a file is created.  Now if that will ever be possible or not, I don't
know, but I am pretty close in one of the branches in my driver-core
tree...

thanks,

greg k-h

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

* Re: [PATCH 2/2] ASoC: dapm: Adapt for debugfs API change
  2019-06-21 13:22   ` Greg KH
@ 2019-06-21 14:30     ` Mark Brown
  2019-06-21 14:53       ` Greg KH
  0 siblings, 1 reply; 9+ messages in thread
From: Mark Brown @ 2019-06-21 14:30 UTC (permalink / raw)
  To: Greg KH; +Cc: Liam Girdwood, alsa-devel, stable

[-- Attachment #1: Type: text/plain, Size: 1135 bytes --]

On Fri, Jun 21, 2019 at 03:22:22PM +0200, Greg KH wrote:
> On Fri, Jun 21, 2019 at 12:33:57PM +0100, Mark Brown wrote:

> >  	struct dentry *d;
> >  
> > -	if (!parent)
> > +	if (!parent || IS_ERR(parent))
> >  		return;

> How can parent be NULL?

It was more effort than it was worth to check to see if it could
actually be NULL through default initialization or something and fix it
than just not delete the check so I just left it there.  I'll probably
go back and clean it up more thorougly at some point.

> I am trying to make it so that debugfs doesn't return anything for when
> a file is created.  Now if that will ever be possible or not, I don't
> know, but I am pretty close in one of the branches in my driver-core
> tree...

You mentioned this in a mail last week, I then replied pointing out that
this is not helpful as it reduces the robustness and quality of our
debugging tools and you then did not respond.  This is a view I still
hold and in any case debugfs as it stands (and was in the kernel
versions since this was broken) is still capable of reporting errors so
we should fix that.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 2/2] ASoC: dapm: Adapt for debugfs API change
  2019-06-21 14:30     ` Mark Brown
@ 2019-06-21 14:53       ` Greg KH
  2019-06-21 15:20         ` Mark Brown
  0 siblings, 1 reply; 9+ messages in thread
From: Greg KH @ 2019-06-21 14:53 UTC (permalink / raw)
  To: Mark Brown; +Cc: Liam Girdwood, alsa-devel, stable

On Fri, Jun 21, 2019 at 03:30:53PM +0100, Mark Brown wrote:
> On Fri, Jun 21, 2019 at 03:22:22PM +0200, Greg KH wrote:
> > On Fri, Jun 21, 2019 at 12:33:57PM +0100, Mark Brown wrote:
> 
> > >  	struct dentry *d;
> > >  
> > > -	if (!parent)
> > > +	if (!parent || IS_ERR(parent))
> > >  		return;
> 
> > How can parent be NULL?
> 
> It was more effort than it was worth to check to see if it could
> actually be NULL through default initialization or something and fix it
> than just not delete the check so I just left it there.  I'll probably
> go back and clean it up more thorougly at some point.
> 
> > I am trying to make it so that debugfs doesn't return anything for when
> > a file is created.  Now if that will ever be possible or not, I don't
> > know, but I am pretty close in one of the branches in my driver-core
> > tree...
> 
> You mentioned this in a mail last week, I then replied pointing out that
> this is not helpful as it reduces the robustness and quality of our
> debugging tools and you then did not respond.

Sorry, had lots of other stuff to work on, it's in my queue to respond
to still...

> This is a view I still hold and in any case debugfs as it stands (and
> was in the kernel versions since this was broken) is still capable of
> reporting errors so we should fix that.

Sort story is, I am trying to change it so that it can not report errors :)

And even then, no kernel code should be doing anything different if
debugfs calls fail or not, that is why I am I making these changes.  No
"real" code should ever be affected, and right now, it is, if something
goes wrong with debugfs.

So removing those checks is the goal here.  Your driver code should not
care if debugfs is working at all or not.

thanks,

greg k-h

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

* Re: [PATCH 2/2] ASoC: dapm: Adapt for debugfs API change
  2019-06-21 14:53       ` Greg KH
@ 2019-06-21 15:20         ` Mark Brown
  0 siblings, 0 replies; 9+ messages in thread
From: Mark Brown @ 2019-06-21 15:20 UTC (permalink / raw)
  To: Greg KH; +Cc: Liam Girdwood, alsa-devel, stable

[-- Attachment #1: Type: text/plain, Size: 1565 bytes --]

On Fri, Jun 21, 2019 at 04:53:09PM +0200, Greg KH wrote:
> On Fri, Jun 21, 2019 at 03:30:53PM +0100, Mark Brown wrote:
> > On Fri, Jun 21, 2019 at 03:22:22PM +0200, Greg KH wrote:

> > This is a view I still hold and in any case debugfs as it stands (and
> > was in the kernel versions since this was broken) is still capable of
> > reporting errors so we should fix that.

> Sort story is, I am trying to change it so that it can not report errors :)

Yes, I know.  This is what I think is a bad idea.

> And even then, no kernel code should be doing anything different if
> debugfs calls fail or not, that is why I am I making these changes.  No
> "real" code should ever be affected, and right now, it is, if something
> goes wrong with debugfs.

> So removing those checks is the goal here.  Your driver code should not
> care if debugfs is working at all or not.

None of which addresses the issue which is that we should be telling
users who are trying to use debugfs to debug things that something went
wrong rather than silently failing and potentially confusing them with
corrupted data display.  This isn't something you can address through
API restrictions without hurting users unless you are prepared to add
user visible error reporting to the debugfs core.

The conditional code here beyond printing errors only affects the
creation of further debugfs files, it's just there to avoid spewing
secondary errors at people when something goes wrong so the underlying
problem is clearer and is entirely compatible with the idea of not
affecting real code.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Applied "ASoC: dapm: Adapt for debugfs API change" to the asoc tree
  2019-06-21 11:33 ` [PATCH 2/2] ASoC: dapm: " Mark Brown
  2019-06-21 13:22   ` Greg KH
@ 2019-06-24 16:32   ` Mark Brown
  1 sibling, 0 replies; 9+ messages in thread
From: Mark Brown @ 2019-06-24 16:32 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel, Liam Girdwood, stable

The patch

   ASoC: dapm: Adapt for debugfs API change

has been applied to the asoc tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.2

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

From ceaea851b9ea75f9ea2bbefb53ff0d4b27cd5a6e Mon Sep 17 00:00:00 2001
From: Mark Brown <broonie@kernel.org>
Date: Fri, 21 Jun 2019 12:33:57 +0100
Subject: [PATCH] ASoC: dapm: Adapt for debugfs API change

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
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/soc-dapm.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 5fc57af9cb6f..a248d88b8968 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -2154,23 +2154,25 @@ void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm,
 {
 	struct dentry *d;
 
-	if (!parent)
+	if (!parent || IS_ERR(parent))
 		return;
 
 	dapm->debugfs_dapm = debugfs_create_dir("dapm", parent);
 
-	if (!dapm->debugfs_dapm) {
+	if (IS_ERR(dapm->debugfs_dapm)) {
 		dev_warn(dapm->dev,
-		       "ASoC: Failed to create DAPM debugfs directory\n");
+			 "ASoC: Failed to create DAPM debugfs directory %ld\n",
+			 PTR_ERR(dapm->debugfs_dapm));
 		return;
 	}
 
 	d = debugfs_create_file("bias_level", 0444,
 				dapm->debugfs_dapm, dapm,
 				&dapm_bias_fops);
-	if (!d)
+	if (IS_ERR(d))
 		dev_warn(dapm->dev,
-			 "ASoC: Failed to create bias level debugfs file\n");
+			 "ASoC: Failed to create bias level debugfs file: %ld\n",
+			 PTR_ERR(d));
 }
 
 static void dapm_debugfs_add_widget(struct snd_soc_dapm_widget *w)
@@ -2184,10 +2186,10 @@ static void dapm_debugfs_add_widget(struct snd_soc_dapm_widget *w)
 	d = debugfs_create_file(w->name, 0444,
 				dapm->debugfs_dapm, w,
 				&dapm_widget_power_fops);
-	if (!d)
+	if (IS_ERR(d))
 		dev_warn(w->dapm->dev,
-			"ASoC: Failed to create %s debugfs file\n",
-			w->name);
+			 "ASoC: Failed to create %s debugfs file: %ld\n",
+			 w->name, PTR_ERR(d));
 }
 
 static void dapm_debugfs_cleanup(struct snd_soc_dapm_context *dapm)
-- 
2.20.1


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

* Applied "ASoC: core: Adapt for debugfs API change" to the asoc tree
  2019-06-21 11:33 [PATCH 1/2] ASoC: core: Adapt for debugfs API change Mark Brown
  2019-06-21 11:33 ` [PATCH 2/2] ASoC: dapm: " Mark Brown
  2019-06-21 13:20 ` [PATCH 1/2] ASoC: core: Adapt for debugfs API change Greg KH
@ 2019-06-24 16:32 ` Mark Brown
  2 siblings, 0 replies; 9+ messages in thread
From: Mark Brown @ 2019-06-24 16:32 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel, Liam Girdwood, stable

The patch

   ASoC: core: Adapt for debugfs API change

has been applied to the asoc tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.2

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

From c2c928c93173f220955030e8440517b87ec7df92 Mon Sep 17 00:00:00 2001
From: Mark Brown <broonie@kernel.org>
Date: Fri, 21 Jun 2019 12:33:56 +0100
Subject: [PATCH] ASoC: core: Adapt for debugfs API change

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
Signed-off-by: Mark Brown <broonie@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 9138fcb15cd3..6aeba0d66ec5 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -158,9 +158,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;
 	}
 
@@ -212,18 +213,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)
-- 
2.20.1


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

end of thread, other threads:[~2019-06-25  9:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-21 11:33 [PATCH 1/2] ASoC: core: Adapt for debugfs API change Mark Brown
2019-06-21 11:33 ` [PATCH 2/2] ASoC: dapm: " Mark Brown
2019-06-21 13:22   ` Greg KH
2019-06-21 14:30     ` Mark Brown
2019-06-21 14:53       ` Greg KH
2019-06-21 15:20         ` Mark Brown
2019-06-24 16:32   ` Applied "ASoC: dapm: Adapt for debugfs API change" to the asoc tree Mark Brown
2019-06-21 13:20 ` [PATCH 1/2] ASoC: core: Adapt for debugfs API change Greg KH
2019-06-24 16:32 ` Applied "ASoC: core: Adapt for debugfs API change" to the asoc tree Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).