aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2017-06-14 10:20:32 -0400
committerTakashi Iwai <tiwai@suse.de>2017-06-14 10:20:32 -0400
commit2deaeaf102d692cb6f764123b1df7aa118a8e97c (patch)
treea577f7290d78183fb0e39438c461eb67d95f3004
parente79b0006c45c9b0b22f3ea54ff6e256b34c1f208 (diff)
ALSA: pcm: Don't treat NULL chmap as a fatal error
The standard PCM chmap helper callbacks treat the NULL info->chmap as a fatal error and spews the kernel warning with stack trace when CONFIG_SND_DEBUG is on. This was OK, originally it was supposed to be always static and non-NULL. But, as the recent addition of Intel LPE audio driver shows, the chmap content may vary dynamically, and it can be even NULL when disconnected. The user still sees the kernel warning unnecessarily. For clearing such a confusion, this patch simply removes the snd_BUG_ON() in each place, just returns an error without warning. Cc: <stable@vger.kernel.org> # v4.11+ Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/core/pcm_lib.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index 5088d4b8db22..009e6c98754e 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -2492,7 +2492,7 @@ static int pcm_chmap_ctl_get(struct snd_kcontrol *kcontrol,
2492 struct snd_pcm_substream *substream; 2492 struct snd_pcm_substream *substream;
2493 const struct snd_pcm_chmap_elem *map; 2493 const struct snd_pcm_chmap_elem *map;
2494 2494
2495 if (snd_BUG_ON(!info->chmap)) 2495 if (!info->chmap)
2496 return -EINVAL; 2496 return -EINVAL;
2497 substream = snd_pcm_chmap_substream(info, idx); 2497 substream = snd_pcm_chmap_substream(info, idx);
2498 if (!substream) 2498 if (!substream)
@@ -2524,7 +2524,7 @@ static int pcm_chmap_ctl_tlv(struct snd_kcontrol *kcontrol, int op_flag,
2524 unsigned int __user *dst; 2524 unsigned int __user *dst;
2525 int c, count = 0; 2525 int c, count = 0;
2526 2526
2527 if (snd_BUG_ON(!info->chmap)) 2527 if (!info->chmap)
2528 return -EINVAL; 2528 return -EINVAL;
2529 if (size < 8) 2529 if (size < 8)
2530 return -ENOMEM; 2530 return -ENOMEM;