mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gergo Koteles <soyer@irl.hu>
To: Mark Brown <broonie@kernel.org>
Cc: Shenghao Ding <shenghao-ding@ti.com>, Kevin Lu <kevin-lu@ti.com>,
	Baojun Xu <baojun.xu@ti.com>, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org
Subject: Re: [PATCH 11/16] ASoC: tas2781: use 0 as default prog/conf index
Date: Sat, 09 Dec 2023 19:20:50 +0100	[thread overview]
Message-ID: <4fccb5ae252ff8efd8b5e760b4a6852ff76c99b5.camel@irl.hu> (raw)
In-Reply-To: <a07270d1-ef63-4558-83aa-223b97b1a93e@sirena.org.uk>

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.


  reply	other threads:[~2023-12-09 18:21 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-07  0:58 [PATCH 00/16] ALSA: hda/tas2781: Add tas2563 support Gergo Koteles
2023-12-06 23:59 ` [PATCH 01/16] ASoC: tas2781: add support for fw version 0x0503 Gergo Koteles
2023-12-06 23:59 ` [PATCH 02/16] ALSA: hda/tas2781: leave hda_component in usable state Gergo Koteles
2023-12-06 23:59 ` [PATCH 03/16] ASoC: tas2781: disable regmap regcache Gergo Koteles
2023-12-07 18:20   ` Mark Brown
2023-12-07 20:19     ` Gergo Koteles
2023-12-07 20:36       ` Mark Brown
2023-12-07 21:12         ` Gergo Koteles
2023-12-07 22:39           ` Mark Brown
2023-12-15  1:17             ` Gergo Koteles
2023-12-15 12:55               ` Mark Brown
2023-12-15 14:42                 ` Gergo Koteles
2023-12-15 15:02                   ` Mark Brown
2023-12-06 23:59 ` [PATCH 04/16] ALSA: hda/tas2781: handle missing calibration data Gergo Koteles
2023-12-06 23:59 ` [PATCH 05/16] ALSA: hda/tas2781: fix typos in comment Gergo Koteles
2023-12-06 23:59 ` [PATCH 06/16] ASoC: tas2781: add ptrs to calibration functions Gergo Koteles
2023-12-07 18:22   ` Mark Brown
2023-12-06 23:59 ` [PATCH 07/16] ALSA: hda/tas2781: load_calibration just load Gergo Koteles
2023-12-06 23:59 ` [PATCH 08/16] ASoC: tas2781: add configurable global_addr Gergo Koteles
2023-12-06 23:59 ` [PATCH 09/16] ALSA: hda/tas2781: add TAS2563 support for 14ARB7 Gergo Koteles
2023-12-07  0:04 ` [PATCH 10/16] ASoC: tas2781: check negative indexes Gergo Koteles
2023-12-07  0:04 ` [PATCH 11/16] ASoC: tas2781: use 0 as default prog/conf index Gergo Koteles
2023-12-07 18:28   ` Mark Brown
2023-12-09 18:20     ` Gergo Koteles [this message]
2023-12-07  0:04 ` [PATCH 12/16] ASoC: tas2781: move set_drv_data outside tasdevice_init Gergo Koteles
2023-12-07  0:04 ` [PATCH 13/16] ALSA: hda/tas2781: remove sound controls in unbind Gergo Koteles
2023-12-07 12:21   ` kernel test robot
2023-12-07 16:00   ` kernel test robot
2023-12-07  0:04 ` [PATCH 14/16] ALSA: hda/tas2781: call cleaner functions only once Gergo Koteles
2023-12-07  0:04 ` [PATCH 15/16] ALSA: hda/tas2781: reset the amp before component_add Gergo Koteles
2023-12-07  0:04 ` [PATCH 16/16] ALSA: hda/tas2781: configure the amp after firmware load Gergo Koteles
2023-12-07 13:55 ` [PATCH 00/16] ALSA: hda/tas2781: Add tas2563 support Mark Brown
2023-12-07 14:38   ` Takashi Iwai
2023-12-30  0:09 ` [PATCH v2 0/4] " Gergo Koteles
2023-12-30  0:09   ` [PATCH v2 1/4] ALSA: hda/tas2781: add ptrs to calibration functions Gergo Koteles
2023-12-30  0:09   ` [PATCH v2 2/4] ALSA: hda/tas2781: add configurable global i2c address Gergo Koteles
2023-12-30  0:09   ` [PATCH v2 3/4] ALSA: hda/tas2781: add TAS2563 support for 14ARB7 Gergo Koteles
2023-12-30  0:09   ` [PATCH v2 4/4] ALSA: hda/tas2781: add fixup for Lenovo 14ARB7 Gergo Koteles
2023-12-30 16:59   ` [PATCH v2 0/4] ALSA: hda/tas2781: Add tas2563 support Takashi Iwai
2023-12-30 20:18     ` Gergo Koteles
2023-12-31  8:33       ` Takashi Iwai
2024-01-02 15:37   ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4fccb5ae252ff8efd8b5e760b4a6852ff76c99b5.camel@irl.hu \
    --to=soyer@irl.hu \
    --cc=alsa-devel@alsa-project.org \
    --cc=baojun.xu@ti.com \
    --cc=broonie@kernel.org \
    --cc=kevin-lu@ti.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=shenghao-ding@ti.com \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®