Skip to content

Commit

Permalink
ASoC: rsnd: tidyup ssi->usrcnt counter check in hw_params
Browse files Browse the repository at this point in the history
ssi->usrcnt will be updated on snd_soc_dai_ops::trigger,
but snd_pcm_ops::hw_params will be called *before* it.
Thus, ssi->usrcnt is still 0 when 1st call.
rsnd_ssi_hw_params() needs to check its called count, this means
trigger should be if (ssi->usrcnt) instead of if (ssi->usrcnt > 1).

Reported-by: Nguyen Viet Dung <[email protected]>
Signed-off-by: Kuninori Morimoto <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
morimoto authored and broonie committed Dec 7, 2016
1 parent 3ce2959 commit 6bf66b1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions sound/soc/sh/rcar/ssi.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,11 +417,14 @@ static int rsnd_ssi_hw_params(struct rsnd_mod *mod,
int chan = params_channels(params);

/*
* Already working.
* It will happen if SSI has parent/child connection.
* snd_pcm_ops::hw_params will be called *before*
* snd_soc_dai_ops::trigger. Thus, ssi->usrcnt is 0
* in 1st call.
*/
if (ssi->usrcnt > 1) {
if (ssi->usrcnt) {
/*
* Already working.
* It will happen if SSI has parent/child connection.
* it is error if child <-> parent SSI uses
* different channels.
*/
Expand Down

0 comments on commit 6bf66b1

Please sign in to comment.