[alsa-devel] [PATCH 1/2] ASoC: core: Adapt for debugfs API change
Greg KH
greg at kroah.com
Fri Jun 21 15:20:40 CEST 2019
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 at kernel.org>
> Cc: stable at 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
More information about the Alsa-devel
mailing list