From f22d8ab3fe46e971f40bed21b159cf0c54d05f98 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Sun, 5 Mar 2006 18:35:45 +0000 Subject: Return the proper error code so that we get a correct error message. git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@627 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/modules/alsa-util.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/modules/alsa-util.c') diff --git a/src/modules/alsa-util.c b/src/modules/alsa-util.c index adb6f3f1..c7be4790 100644 --- a/src/modules/alsa-util.c +++ b/src/modules/alsa-util.c @@ -263,25 +263,25 @@ int pa_alsa_set_hw_params(snd_pcm_t *pcm_handle, const pa_sample_spec *ss, uint3 }; assert(pcm_handle && ss && periods && period_size); - if (snd_pcm_hw_params_malloc(&hwparams) < 0 || - snd_pcm_hw_params_any(pcm_handle, hwparams) < 0 || - snd_pcm_hw_params_set_access(pcm_handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED) < 0 || - snd_pcm_hw_params_set_format(pcm_handle, hwparams, format_trans[ss->format]) < 0 || - snd_pcm_hw_params_set_rate_near(pcm_handle, hwparams, &r, NULL) < 0 || - snd_pcm_hw_params_set_channels(pcm_handle, hwparams, ss->channels) < 0 || - (*periods > 0 && snd_pcm_hw_params_set_periods_near(pcm_handle, hwparams, periods, NULL) < 0) || - (*period_size > 0 && snd_pcm_hw_params_set_period_size_near(pcm_handle, hwparams, period_size, NULL) < 0) || - snd_pcm_hw_params(pcm_handle, hwparams) < 0) + if ((ret = snd_pcm_hw_params_malloc(&hwparams)) < 0 || + (ret = snd_pcm_hw_params_any(pcm_handle, hwparams)) < 0 || + (ret = snd_pcm_hw_params_set_access(pcm_handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0 || + (ret = snd_pcm_hw_params_set_format(pcm_handle, hwparams, format_trans[ss->format])) < 0 || + (ret = snd_pcm_hw_params_set_rate_near(pcm_handle, hwparams, &r, NULL)) < 0 || + (ret = snd_pcm_hw_params_set_channels(pcm_handle, hwparams, ss->channels)) < 0 || + (*periods > 0 && (ret = snd_pcm_hw_params_set_periods_near(pcm_handle, hwparams, periods, NULL)) < 0) || + (*period_size > 0 && (ret = snd_pcm_hw_params_set_period_size_near(pcm_handle, hwparams, period_size, NULL)) < 0) || + (ret = snd_pcm_hw_params(pcm_handle, hwparams)) < 0) goto finish; if (ss->rate != r) pa_log_info(__FILE__": device doesn't support %u Hz, changed to %u Hz.", ss->rate, r); - if (snd_pcm_prepare(pcm_handle) < 0) + if ((ret = snd_pcm_prepare(pcm_handle)) < 0) goto finish; - if (snd_pcm_hw_params_get_buffer_size(hwparams, &buffer_size) < 0 || - snd_pcm_hw_params_get_period_size(hwparams, period_size, NULL) < 0) + if ((ret = snd_pcm_hw_params_get_buffer_size(hwparams, &buffer_size)) < 0 || + (ret = snd_pcm_hw_params_get_period_size(hwparams, period_size, NULL)) < 0) goto finish; assert(buffer_size > 0); -- cgit