diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2015-04-09 04:52:38 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-04-09 07:23:14 -0400 |
commit | 6553bf06a369683408895b87e5172aa99a9266bd (patch) | |
tree | 39ddb89fa018f224eb46b67894f0ff13ae986ac5 /sound/soc/soc-pcm.c | |
parent | 2e55b90a5e234524f8195c657006ec4f71103dff (diff) |
ASoC: Don't try to register debugfs entries if the parent does not exist
If the registration of a debugfs directory fails this is treated as a
non-fatal error in ASoC and operation continues as normal. This means we
need to be careful and check if the parent debugfs directory exists if we
try to register a debugfs file or sub-directory. Otherwise we might end up
passing NULL for the parent and the file or directory will be registered in
the top-level debugfs directory.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/soc-pcm.c')
-rw-r--r-- | sound/soc/soc-pcm.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 9c514fde7154..b0d61e6531e6 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c | |||
@@ -1097,8 +1097,9 @@ static int dpcm_be_connect(struct snd_soc_pcm_runtime *fe, | |||
1097 | stream ? "<-" : "->", be->dai_link->name); | 1097 | stream ? "<-" : "->", be->dai_link->name); |
1098 | 1098 | ||
1099 | #ifdef CONFIG_DEBUG_FS | 1099 | #ifdef CONFIG_DEBUG_FS |
1100 | dpcm->debugfs_state = debugfs_create_u32(be->dai_link->name, 0644, | 1100 | if (fe->debugfs_dpcm_root) |
1101 | fe->debugfs_dpcm_root, &dpcm->state); | 1101 | dpcm->debugfs_state = debugfs_create_u32(be->dai_link->name, 0644, |
1102 | fe->debugfs_dpcm_root, &dpcm->state); | ||
1102 | #endif | 1103 | #endif |
1103 | return 1; | 1104 | return 1; |
1104 | } | 1105 | } |
@@ -2807,6 +2808,9 @@ void soc_dpcm_debugfs_add(struct snd_soc_pcm_runtime *rtd) | |||
2807 | if (!rtd->dai_link) | 2808 | if (!rtd->dai_link) |
2808 | return; | 2809 | return; |
2809 | 2810 | ||
2811 | if (!rtd->card->debugfs_card_root) | ||
2812 | return; | ||
2813 | |||
2810 | rtd->debugfs_dpcm_root = debugfs_create_dir(rtd->dai_link->name, | 2814 | rtd->debugfs_dpcm_root = debugfs_create_dir(rtd->dai_link->name, |
2811 | rtd->card->debugfs_card_root); | 2815 | rtd->card->debugfs_card_root); |
2812 | if (!rtd->debugfs_dpcm_root) { | 2816 | if (!rtd->debugfs_dpcm_root) { |