Skip to content

Commit

Permalink
sound: fsl_hdmi: Fix return value handling when setting constraints.
Browse files Browse the repository at this point in the history
Some of the snd_pcm_hw_constraint_xxx() functions may return non-zero
positive values in case of success. So in order to detect errors we
should check for negatives.

Signed-off-by: Rudi <r.ihle@s-t.de>
  • Loading branch information
warped-rudi committed Aug 17, 2015
1 parent 8881155 commit 040f5ac
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sound/soc/fsl/fsl_hdmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,23 +348,23 @@ static int fsl_hdmi_update_constraints(struct snd_pcm_substream *substream)
fsl_hdmi_get_playback_rates();
ret = snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
&playback_constraint_rates);
if (ret)
if (ret < 0)
return ret;

fsl_hdmi_get_playback_sample_size();
ret = snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_SAMPLE_BITS,
&playback_constraint_bits);
if (ret)
if (ret < 0)
return ret;

fsl_hdmi_get_playback_channels();
ret = snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
&playback_constraint_channels);
if (ret)
if (ret < 0)
return ret;

ret = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
if (ret)
if (ret < 0)
return ret;

return 0;
Expand Down

0 comments on commit 040f5ac

Please sign in to comment.