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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
> Cc: stable@xxxxxxxxxxxxxxx
> ---
>  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
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux