[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4fccb5ae252ff8efd8b5e760b4a6852ff76c99b5.camel@irl.hu>
Date: Sat, 09 Dec 2023 19:20:50 +0100
From: Gergo Koteles <soyer@....hu>
To: Mark Brown <broonie@...nel.org>
Cc: Shenghao Ding <shenghao-ding@...com>, Kevin Lu <kevin-lu@...com>,
Baojun Xu <baojun.xu@...com>, Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
Liam Girdwood <lgirdwood@...il.com>,
linux-kernel@...r.kernel.org, alsa-devel@...a-project.org
Subject: Re: [PATCH 11/16] ASoC: tas2781: use 0 as default prog/conf index
On Thu, 2023-12-07 at 18:28 +0000, Mark Brown wrote:
> On Thu, Dec 07, 2023 at 01:04:27AM +0100, Gergo Koteles wrote:
>
> > Invalid indexes are not the best default values.
>
> I'm guessing this is just fallout from the previous (not really
> explained patch)? Is there perhaps some bootstrapping issue here with
> ensuring that the program and configuration get written to the device if
> the user doesn't explicitly select something in a control?
I added the >0 checks because I encountered a NULL pointer dereference.
Because
tasdevice_init sets
tas_priv->cur_prog = -1
tas_priv->cur_conf = -1
tasdev_fw_ready calls tasdevice_prmg_load(tas_priv, 0) which sets
tasdevice[i]->prg_no = 0
Then the playback hook calls
tasdevice_tuning_switch(tas_hda->priv, 0)
tasdevice_select_tuningprm_cfg(tas_priv, cur_prog (-1), cur_conf (-1),
profile_cfg_id (0));
tasdevice_select_tuningprm_cfg checks
if (tas_priv->tasdevice[i].cur_prog (0) != prm_no (-1)
and tries to load the program from
program = &(tas_fmw->programs[prm_no (-1)]);
tasdevice_load_data(tas_priv, &(program->dev_data));
I think the intention was to load the first program, first
configuration, first profile. And that's the safe thing to do.
So I expressed that with this commit.
Yes, I need to write much better commit messages.
Powered by blists - more mailing lists