Re: Need help with patch for #2724 (usbaudio, core)

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

 



At Wed, 31 Jan 2007 12:22:19 +0100,
Gregor Jasny wrote:
> 
> Takashi Iwai wrote:
> > This is the right fix, too.  Of course, pcm-core should be more
> > robust, but the cause of the bug is the bogus entry.
> 
> Your patch does not change anything. I've enabled 
> CONFIG_SND_VERBOSE_PRINTK, CONFIG_SND_DEBUG and CONFIG_SND_DEBUG_DETECT 
> in the kernel config.

Interesting.  So, you still got an Oops, right?

> None of your snd_printd output gets triggered. I've placed a test output 
> in pcm-native, so debugging works.

OK, then how about the one below?

> > The patch looks fine to me.  Please provide a proper changelog and a
> > sign-off for merging.
> 
> Done. The patch is against the current hg snapshot of alsa-kernel.

Thanks.  I applied it to HG tree now.


Takashi

diff -r 776cac567090 core/pcm_native.c
--- a/core/pcm_native.c	Wed Jan 31 12:27:39 2007 +0100
+++ b/core/pcm_native.c	Wed Jan 31 12:31:37 2007 +0100
@@ -1959,52 +1959,87 @@ int snd_pcm_hw_constraints_complete(stru
 			mask |= 1 << SNDRV_PCM_ACCESS_MMAP_COMPLEX;
 	}
 	err = snd_pcm_hw_constraint_mask(runtime, SNDRV_PCM_HW_PARAM_ACCESS, mask);
-	snd_assert(err >= 0, return -EINVAL);
+	if (err < 0) {
+		snd_printd("cannot set access mask\n");
+		return err;
+	}
 
 	err = snd_pcm_hw_constraint_mask64(runtime, SNDRV_PCM_HW_PARAM_FORMAT, hw->formats);
-	snd_assert(err >= 0, return -EINVAL);
+	if (err < 0) {
+		snd_printd("cannot set format mask\n");
+		return err;
+	}
 
 	err = snd_pcm_hw_constraint_mask(runtime, SNDRV_PCM_HW_PARAM_SUBFORMAT, 1 << SNDRV_PCM_SUBFORMAT_STD);
-	snd_assert(err >= 0, return -EINVAL);
+	if (err < 0) {
+		snd_printd("cannot set subformat mask\n");
+		return err;
+	}
 
 	err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_CHANNELS,
 					   hw->channels_min, hw->channels_max);
-	snd_assert(err >= 0, return -EINVAL);
+	if (err < 0) {
+		snd_printd("cannot set channels minmax\n");
+		return err;
+	}
 
 	err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_RATE,
 					   hw->rate_min, hw->rate_max);
-	snd_assert(err >= 0, return -EINVAL);
+	if (err < 0) {
+		snd_printd("cannot set rate minmax\n");
+		return err;
+	}
+	if (!hw->rates) {
+		snd_printd("invalid hw->rates\n");
+		return -EINVAL;
+	}
 
 	err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
 					   hw->period_bytes_min, hw->period_bytes_max);
-	snd_assert(err >= 0, return -EINVAL);
+	if (err < 0) {
+		snd_printd("cannot set periods_bytes minmax\n");
+		return err;
+	}
 
 	err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIODS,
 					   hw->periods_min, hw->periods_max);
-	snd_assert(err >= 0, return -EINVAL);
+	if (err < 0) {
+		snd_printd("cannot set periods minmax\n");
+		return err;
+	}
 
 	err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
 					   hw->period_bytes_min, hw->buffer_bytes_max);
-	snd_assert(err >= 0, return -EINVAL);
+	if (err < 0) {
+		snd_printd("cannot set buffer_bytes minmax\n");
+		return err;
+	}
 
 	err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 
 				  snd_pcm_hw_rule_buffer_bytes_max, substream,
 				  SNDRV_PCM_HW_PARAM_BUFFER_BYTES, -1);
-	if (err < 0)
+	if (err < 0) {
+		snd_printd("cannot set buffer_bytes limit\n");
 		return err;
+	}
 
 	/* FIXME: remove */
 	if (runtime->dma_bytes) {
 		err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 0, runtime->dma_bytes);
-		snd_assert(err >= 0, return -EINVAL);
+		if (err < 0) {
+			snd_printd("cannot set dma_bytes limit\n");
+			return err;
+		}
 	}
 
 	if (!(hw->rates & (SNDRV_PCM_RATE_KNOT | SNDRV_PCM_RATE_CONTINUOUS))) {
 		err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, 
 					  snd_pcm_hw_rule_rate, hw,
 					  SNDRV_PCM_HW_PARAM_RATE, -1);
-		if (err < 0)
+		if (err < 0) {
+			snd_printd("cannot set rate mask\n");
 			return err;
+		}
 	}
 
 	/* FIXME: this belong to lowlevel */

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-devel

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

  Powered by Linux