未验证 提交 51a630a7 编写于 作者: R Richard Fitzgerald 提交者: Mark Brown

ASoC: simple-card-utils: Avoid NULL deref in asoc_simple_set_tdm()

Don't dereference simple_dai before it has been checked for NULL.
Signed-off-by: NRichard Fitzgerald <rf@opensource.cirrus.com>
Fixes: 1e974e5b ("ASoC: audio_graph_card2: Add support for variable slot widths")
Reported-by: Nkernel test robot <lkp@intel.com>
Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20220404113252.1152659-1-rf@opensource.cirrus.comSigned-off-by: NMark Brown <broonie@kernel.org>
上级 89bac792
......@@ -364,13 +364,15 @@ static int asoc_simple_set_tdm(struct snd_soc_dai *dai,
struct snd_pcm_hw_params *params)
{
int sample_bits = params_width(params);
int slot_width = simple_dai->slot_width;
int slot_count = simple_dai->slots;
int slot_width, slot_count;
int i, ret;
if (!simple_dai || !simple_dai->tdm_width_map)
return 0;
slot_width = simple_dai->slot_width;
slot_count = simple_dai->slots;
if (slot_width == 0)
slot_width = sample_bits;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册