Skip to content

Commit

Permalink
ASoC: Intel: sof_maxim_common: check return value
Browse files Browse the repository at this point in the history
snd_soc_dai_set_tdm_slot() could return error.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
  • Loading branch information
bardliao authored and plbossart committed Nov 10, 2023
1 parent 1de8d26 commit 453fdbb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions sound/soc/intel/boards/sof_maxim_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,21 @@ static int max_98373_hw_params(struct snd_pcm_substream *substream,
{
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
struct snd_soc_dai *codec_dai;
int ret = 0;
int j;

for_each_rtd_codec_dais(rtd, j, codec_dai) {
if (!strcmp(codec_dai->component->name, MAX_98373_DEV0_NAME)) {
/* DEV0 tdm slot configuration */
snd_soc_dai_set_tdm_slot(codec_dai, 0x03, 3, 8, 32);
ret = snd_soc_dai_set_tdm_slot(codec_dai, 0x03, 3, 8, 32);
} else if (!strcmp(codec_dai->component->name, MAX_98373_DEV1_NAME)) {
/* DEV1 tdm slot configuration */
snd_soc_dai_set_tdm_slot(codec_dai, 0x0C, 3, 8, 32);
ret = snd_soc_dai_set_tdm_slot(codec_dai, 0x0C, 3, 8, 32);
}
if (ret < 0) {
dev_err(codec_dai->dev, "fail to set tdm slot, ret %d\n",
ret);
return ret;
}
}
return 0;
Expand Down

0 comments on commit 453fdbb

Please sign in to comment.