Message ID | 88229933b7aaf0777cbe611979712e4e144b1ca1.1701906455.git.soyer@irl.hu |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp4456964vqy; Wed, 6 Dec 2023 16:05:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IGWIYr7aJGBvumGC8Dv+pTHQQd2PS/Jn03Vhf9MC4YajVsY9loePVVI838mmrsOhX7nmom/ X-Received: by 2002:a05:6a21:970e:b0:18f:9c4:d34f with SMTP id ub14-20020a056a21970e00b0018f09c4d34fmr3716800pzb.63.1701907515416; Wed, 06 Dec 2023 16:05:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701907515; cv=none; d=google.com; s=arc-20160816; b=o07dAXQJoF2EiGvscbKZiNMcdEPEv9dy08IMqccFgokSWMeVfnLnmA6xyNZmIRBXag 3RzpcshiI82dpzH6tO2Zw8F7KtIe8MgZzw3t0HJ3zOfnAr4RkVaiPSLei4mgyAEkK+Tl 2CmlE569/iMfag+6pl3cuA4Sn7bL6UHeiHZxIBaq3YGP1WBEPYZ9ofAPtK+xk3k+ACNj xPSySq2mdr1SLpIRPS2YVX3lNdTLOf08Wc7BnvyGcAiDiCA8M1SCTPVZ7ilgUH4QURii wVIKGoyZ7/BLYnTChhG4cvqH/YP1FI0kxN81Z95xqbt/GdqkUBIbfcccIfrQ5gDSnJmQ DbHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=sFugFii6oaNiWGTMYoVh7airdeh83CUtDYigNac51EE=; fh=zySoyVfK/7ExaDz2MWyww8poQ40q3tZak5TTvfb/Ovc=; b=Ty/8BGPcPoELbTKmYTzla9MEbYf98HjClwfLOiL9QXp/lCUNqnhp1Xv3iLE3XWpvl6 oKEyK2Xf8E0+k4mRSRAe4ICLQTepa2vZnKgldk9bz6jzsyV6rekrC2Z5cDAjGCKfM9LZ GQtdgcyApw3FzyT5tt632YXctENTgPpz60tkJNHokQ6Ckx69BkRAsy0j1Nger/AT1PQO YtpCVIcVVGOahx2UXKEd3VmDRqFTPQzq13LWnuHWSUOkT8jkOAXRYcb41tpXfmqhKKK3 w0C6byC0VIah0M/kIsi133IOQHoyeekvrV61s3FESngDZWV3oXwoMPmMk6OhKrKGawsE kcEw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=irl.hu Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id c3-20020a6566c3000000b005c6689f9d81si118923pgw.215.2023.12.06.16.05.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 16:05:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=irl.hu Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 1A410809B9D2; Wed, 6 Dec 2023 16:05:11 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231248AbjLGAE7 (ORCPT <rfc822;pusanteemu@gmail.com> + 99 others); Wed, 6 Dec 2023 19:04:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232511AbjLGAEm (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 6 Dec 2023 19:04:42 -0500 Received: from irl.hu (irl.hu [95.85.9.111]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FAE1D5A for <linux-kernel@vger.kernel.org>; Wed, 6 Dec 2023 16:04:38 -0800 (PST) Received: from fedori.lan (51b690cd.dsl.pool.telekom.hu [::ffff:81.182.144.205]) (AUTH: CRAM-MD5 soyer@irl.hu, ) by irl.hu with ESMTPSA id 00000000000716F4.0000000065710C14.001190BB; Thu, 07 Dec 2023 01:04:36 +0100 From: Gergo Koteles <soyer@irl.hu> To: 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>, Mark Brown <broonie@kernel.org> Cc: linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, Gergo Koteles <soyer@irl.hu> Subject: [PATCH 11/16] ASoC: tas2781: use 0 as default prog/conf index Date: Thu, 7 Dec 2023 01:04:27 +0100 Message-ID: <88229933b7aaf0777cbe611979712e4e144b1ca1.1701906455.git.soyer@irl.hu> X-Mailer: git-send-email 2.43.0 In-Reply-To: <cover.1701906455.git.soyer@irl.hu> References: <cover.1701906455.git.soyer@irl.hu> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Mime-Autoconverted: from 8bit to 7bit by courier 1.0 X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 06 Dec 2023 16:05:11 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784579375352888229 X-GMAIL-MSGID: 1784579375352888229 |
Series |
ALSA: hda/tas2781: Add tas2563 support
|
|
Commit Message
Gergo Koteles
Dec. 7, 2023, 12:04 a.m. UTC
Invalid indexes are not the best default values.
Signed-off-by: Gergo Koteles <soyer@irl.hu>
---
sound/soc/codecs/tas2781-comlib.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Comments
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?
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.
diff --git a/sound/soc/codecs/tas2781-comlib.c b/sound/soc/codecs/tas2781-comlib.c index f914123c7284..635f97db033b 100644 --- a/sound/soc/codecs/tas2781-comlib.c +++ b/sound/soc/codecs/tas2781-comlib.c @@ -307,8 +307,8 @@ int tasdevice_init(struct tasdevice_priv *tas_priv) goto out; } - tas_priv->cur_prog = -1; - tas_priv->cur_conf = -1; + tas_priv->cur_prog = 0; + tas_priv->cur_conf = 0; for (i = 0; i < tas_priv->ndev; i++) { tas_priv->tasdevice[i].cur_book = -1;