Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp3081584rdb; Sat, 9 Dec 2023 10:21:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IEj08St/S/0iyfVyQwRbETOCnF/6PuU3BKD1S1OexteL91OAmoUco0uGs7O1/6syydN3kS1 X-Received: by 2002:a05:6808:22a6:b0:3ba:380:87ad with SMTP id bo38-20020a05680822a600b003ba038087admr38226oib.99.1702146069627; Sat, 09 Dec 2023 10:21:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702146069; cv=none; d=google.com; s=arc-20160816; b=lOkroEJ5Ms3BoGSGa0THjHLqywVye/8vYtSo+WPVox1R4qlsGO5MnkH7HciCage1CT w7tmOhMpnjMAGPD5THh13ezLdWnnAdbUcaZ1P9WVChsH4hcu2/8usu2lTmgCk6Awbity GgB/51XKuZRvpd3Uh4GikNHKupLXnoOc0544GsDV3MdNKnFdDi6NHxbmzpFBqzLskxWx AVLRcsMUTO7dZmGwdcTQ2kQighJM7NhuinyfcZJpuoGdj8i+FD8vqxvZZTFdF9tfVH8E N+wS5+tlFqh9iac3xC/O7LFW7Pg1qH2YvYn/PGataJkzQvdj3ff6rAC8jk8lt0DUawqu du0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id; bh=vHJ48e7w6/yfflmHFFgq6QhcH+M+nN+p7HH4EcgLIgU=; fh=ZR6V6D2WU0zyIjfQPX7YfmWZmlvbVzl0m0Qi5vpsgvY=; b=UxMU7mg2eqgqmQMPVLHx5xTFdFqwfVc3oadxPnB80vtPEQukfSftqTY16TCf/hg1fP epENILH9M8itLzyjRjQDKoE2im1lJ+Y1XuHW2j46AEvFnAOWFKETyXdhloM/w1f+V+e3 DlTnJF6kBUdK8gQEF+fDRB90pKaFx1ZJc8/UQgtZ3/Li14g5BiWediuCNgFCICJNz0eT ys0Xo3hIlsoSSCkAY/AnFyznMtR4ykqzC3qmzzcFDT0Ef2EqvJgj+wWBAGj266dQsAZF WqFCq6WjMCaV/A3daBfgpLI2PIOW6V9VttBPOb8UssZA5Y+pdwDIBtuKWFjcTDlVOxRJ qzZg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=irl.hu Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id ko19-20020a056a00461300b006ce83264887si3478065pfb.57.2023.12.09.10.21.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Dec 2023 10:21:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id 7944F8065820; Sat, 9 Dec 2023 10:21:07 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229498AbjLISUx convert rfc822-to-8bit (ORCPT + 99 others); Sat, 9 Dec 2023 13:20:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229453AbjLISUv (ORCPT ); Sat, 9 Dec 2023 13:20:51 -0500 Received: from irl.hu (irl.hu [95.85.9.111]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42405E1 for ; Sat, 9 Dec 2023 10:20:56 -0800 (PST) Received: from [192.168.2.4] (51b690cd.dsl.pool.telekom.hu [::ffff:81.182.144.205]) (AUTH: CRAM-MD5 soyer@irl.hu, ) by irl.hu with ESMTPSA id 000000000006FA9A.000000006574B003.0011E711; Sat, 09 Dec 2023 19:20:51 +0100 Message-ID: <4fccb5ae252ff8efd8b5e760b4a6852ff76c99b5.camel@irl.hu> Subject: Re: [PATCH 11/16] ASoC: tas2781: use 0 as default prog/conf index From: Gergo Koteles To: Mark Brown Cc: Shenghao Ding , Kevin Lu , Baojun Xu , Jaroslav Kysela , Takashi Iwai , Liam Girdwood , linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org Date: Sat, 09 Dec 2023 19:20:50 +0100 In-Reply-To: References: <88229933b7aaf0777cbe611979712e4e144b1ca1.1701906455.git.soyer@irl.hu> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.50.2 (3.50.2-1.fc39) MIME-Version: 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 agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Sat, 09 Dec 2023 10:21:07 -0800 (PST) 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.