Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1833247lqm; Fri, 3 May 2024 07:49:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUg09lsL68bLd1H1nZw9Y86Tekj4ouDo1YBzDwnV7PqhkcYe1EZPvpArHsWvULYVPsmqVn7HiGRT1jL3lZAVlN0Zv+cinYxIVRyE+K4jw== X-Google-Smtp-Source: AGHT+IE6zCnzzZV1ufz4uPql0wLtakfpOYByTkzHNwvJra4rZo64UMfOCMGND2Txi6+ShsFZcmOO X-Received: by 2002:a05:6870:a2ce:b0:22e:9c5a:233e with SMTP id w14-20020a056870a2ce00b0022e9c5a233emr3160685oak.43.1714747783437; Fri, 03 May 2024 07:49:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714747783; cv=pass; d=google.com; s=arc-20160816; b=mnzvnEiOtOGWPyzgBETgwzFL5m1B/9SR6SR/DERTrlkJsnFHwaYnYMZNF+4mzHwaVK 2SGqG0/6lSK9mhg0QzuWeqCvuW7qemPScZ1+IhOq4nMYOa8R2gTMDQBIvy+3nZ8BKN3w Qf/vA8DD22MVnTgJfZ4Ugb2kYQJUkysUk8pw0DvTQ5C2HWqi+qr4B30t2X1uE+O0uUJR vE3CLcxyMfsAJbxyezDhv3lvCO1IPyqjt/qmajNa3Mnu055v9peHgCFD9+JwM+j/p5+b C9UMC4YYmC1JCvxt57M8I5MZNVoVZBr7PEf30ykX82IC5NfXA5o1NRVJsSnYvLuJd3W9 7tSQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=e9rixmbrWHDGZ6J2M+NgxEP1yn4EKSSaL4tVG+ihimE=; fh=nntuEEIe8zz8gGKh540YT/E0DGo/lzzJ/DvnKSapvp4=; b=URCXOINWGNXAhZhsxAnXCcKM9QPuRzyi7AnizK9CPkxmWSghSdQ8Kg1JuJnqHjwS+W 8X8dT0CPVVsJPN7Jy8s2K3qQEKt4rkfK51b3BNaGZLK0H6QC9rTAJWjJ+q/c6I3EEtdr FQGGK7GZgDSFXjVJ8RXvienXfDM0qOXzc4PCD5u9RrKhiObtnmT/xH0AlmWjqSO7pKec UsTe7PSskLvhXHKPppExVdCU5L9rv0w0MfAuIZtBVdDQ2bVh3EZ/55mJVUJ7aJT7+sAh jCLOdcPyrlI/mcT9jR5T9wnf1CXhDROcvjyt8zsGis0SVMcvPuhCZoTUPHQ3xspDiu5m 5YtQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=P66wCa8G; arc=pass (i=1 spf=pass spfdomain=opensource.cirrus.com dkim=pass dkdomain=cirrus.com dmarc=pass fromdomain=opensource.cirrus.com); spf=pass (google.com: domain of linux-kernel+bounces-167794-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-167794-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id a6-20020a05620a438600b007927df9962dsi1765557qkp.621.2024.05.03.07.49.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 07:49:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-167794-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=P66wCa8G; arc=pass (i=1 spf=pass spfdomain=opensource.cirrus.com dkim=pass dkdomain=cirrus.com dmarc=pass fromdomain=opensource.cirrus.com); spf=pass (google.com: domain of linux-kernel+bounces-167794-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-167794-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id E07BD1C22700 for ; Fri, 3 May 2024 14:49:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 943FA46B80; Fri, 3 May 2024 14:49:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b="P66wCa8G" Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 012E342056; Fri, 3 May 2024 14:49:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.152.168 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714747775; cv=none; b=R2yVOXD3qI5F8ES34mDT2v5StRbZG+sGbAmad3hvW+QQxbZRHNUvFj3MlXm9SwVEZQPTA0k+RLfcOwgKcUaSgtJi6iKHp0ZTkWXGeBuAu/S1QtUQuyGc1xsI16YH2tKeFCWuEmChIaSo4SvwrbioMIBOerImD0UYHzLg+GmMHb0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714747775; c=relaxed/simple; bh=ZdaAcZwjeEGQL9HK0+7ZDImDJwKA/pqYRR2WTr4YDiM=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=BbKk1HbM+aQ1W+tEtO+CKCamqENFLPT6dn0R+aX1Se5wUNi5fArGLP1X1b0CkeiYuuzGfPmO35dhLJuRuIhqhoyEyykktA4B9pfmTGPeUpvpH815befv2cJyCohchh+sTELWKTB0LJfIUAQk0UbTnR9KcxtW1xhpZ1B/cOV0LsA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensource.cirrus.com; spf=pass smtp.mailfrom=opensource.cirrus.com; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b=P66wCa8G; arc=none smtp.client-ip=67.231.152.168 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensource.cirrus.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=opensource.cirrus.com Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4436vduw010022; Fri, 3 May 2024 09:49:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding:content-type; s=PODMain02222019; bh=e 9rixmbrWHDGZ6J2M+NgxEP1yn4EKSSaL4tVG+ihimE=; b=P66wCa8GLTtrFWKdE PfQ7r9FrXlgaNykLWwGyIYcD+OhuKU9SeZDW/rFjqbVszsxMdWLZh6weseJoFGwD HrUx0sV5jTIP2wMim1DpqUaVKQpcH6g2YBrtPtuASZTfGdVQaePFBp3p9hpb2eDx Rm1syQ5Yo1D8eJnGxkdf4X0uU8a+RwzEmhSnMg0ib+F6BLhjgh3uH87gS4xyUZua ZwVHXcYp/HvG/LIYgUcYc5FIh93F+QO9IxPISnZDffCS1Hi815fqTUQ6G9Yzn1/U l2ZjKvdwyItvH1kj+w7Y2anbv65nRBZLDjiog40G6oPeqdhjq+vXfUznB2DN5WXH bSDkg== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0b-001ae601.pphosted.com (PPS) with ESMTPS id 3xv0e8hn7v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 03 May 2024 09:49:22 -0500 (CDT) Received: from ediex02.ad.cirrus.com (198.61.84.81) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Fri, 3 May 2024 15:49:20 +0100 Received: from ediswmail9.ad.cirrus.com (198.61.86.93) by anon-ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server id 15.2.1544.9 via Frontend Transport; Fri, 3 May 2024 15:49:20 +0100 Received: from ediswws06.ad.cirrus.com (ediswws06.ad.cirrus.com [198.90.208.18]) by ediswmail9.ad.cirrus.com (Postfix) with ESMTP id 506D582026C; Fri, 3 May 2024 14:49:20 +0000 (UTC) From: Richard Fitzgerald To: CC: , , , Subject: [PATCH] ALSA: hda/cs_dsp_ctl: Actually remove ALSA controls Date: Fri, 3 May 2024 15:49:20 +0100 Message-ID: <20240503144920.61075-1-rf@opensource.cirrus.com> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: M9uz6xZrXz6IqMHVhnaAae2NIHxiVlhN X-Proofpoint-GUID: M9uz6xZrXz6IqMHVhnaAae2NIHxiVlhN X-Proofpoint-Spam-Reason: safe hda_cs_dsp_control_remove() must remove the ALSA control when deleting all the infrastructure for handling the control. Without this it is possible for ALSA controls to be left in the Soundcard after the amp driver module has been unloaded. So the get/set callbacks point to code that no longer exists. Signed-off-by: Richard Fitzgerald Fixes: 3233b978af23 ("ALSA: hda: hda_cs_dsp_ctl: Add Library to support CS_DSP ALSA controls") --- Note: it would be better to use the control private_free to do the cleanup, and that is my plan long-term. But that is a larger change to the code. I like to keep bugfix patches as simple as possible so they are low-risk and easy to cherry-pick into older kernels. So this patch fixes the bug. Sometime I will send a patch for future kernel versions that reworks the cleanup to use private_free. --- sound/pci/hda/hda_cs_dsp_ctl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sound/pci/hda/hda_cs_dsp_ctl.c b/sound/pci/hda/hda_cs_dsp_ctl.c index 463ca06036bf..a42653d3473d 100644 --- a/sound/pci/hda/hda_cs_dsp_ctl.c +++ b/sound/pci/hda/hda_cs_dsp_ctl.c @@ -203,6 +203,10 @@ void hda_cs_dsp_control_remove(struct cs_dsp_coeff_ctl *cs_ctl) { struct hda_cs_dsp_coeff_ctl *ctl = cs_ctl->priv; + /* Only public firmware controls will have an associated kcontrol */ + if (ctl && ctl->kctl) + snd_ctl_remove(ctl->card, ctl->kctl); + kfree(ctl); } EXPORT_SYMBOL_NS_GPL(hda_cs_dsp_control_remove, SND_HDA_CS_DSP_CONTROLS); -- 2.39.2