Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp380017lqh; Fri, 31 May 2024 04:28:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVjBZ2lTMAi0RYPByqFJBtQ9xxGL/7TTg9QtRB5VzE0OwBZDVuluvZtC6jnXbZfxjQDMOeVb6hZXL8Y9HW0fA/PdPZJqlS3tQTx9CpBEw== X-Google-Smtp-Source: AGHT+IHI1fDIY0YRhKfsOG3PqtIoFNTL1DXYms9j7RduxdpBTurmOCqjAa5S2ReOaCIl0DpSfaR+ X-Received: by 2002:a50:a459:0:b0:578:4a53:1029 with SMTP id 4fb4d7f45d1cf-57a363c0211mr1065450a12.4.1717154887748; Fri, 31 May 2024 04:28:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717154887; cv=pass; d=google.com; s=arc-20160816; b=elDbpCabZN3BAYEaUboMkHSNBza97tFqrmpW4ao2SvT/AbCkoXkK90+PsL49QSN13X EM+0ng/qslrQJcAn6jPAJZNXajxCyN6vMj8dqob4kkrbs6d8NOwXSfIzrcTvq0iEFvOy JJfJ5T5ek16iHoI97Wf29iO43OymQR6WobL5atCGcppOuz4rcoJGw86xlvnN6go8/KUd 1KfIg7RdCgbTEKLJvuzi+GyZDCjCK2ARBYNu/CQYajVSrTxWhJTZsKmKE8ktwPIXMab4 cS5JhytlH8dRo0LJXyl27ccz29QJQ/ZoXEu/x8Sp5K3Yy2eCV2PFnpvfKWq2gjFevuyl k7vw== 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=uqUvYOPYn4wZFfXtU6r/PgcMGfsmSJF3lS2+gb15emQ=; fh=z7rId80B5i8icwLN4amYRAcHgJDKcj48lemekrTKtzM=; b=bwC9OY1m9/xYBc+4rkb+QZWq1uMsKZYrI3mkoXHM60WDgGYl/j7KqcuWLWAsk+sO1C Q29paD65rVrYz/AejwMANMAAP7D0eCYeyW+7oUh+vbWJTtXS6gXW5eWRJqsNkaJhBU0J O2DMq+3ODMwskvh1L+B9D4zfaNRCfNFdFFgT28C9tE6WaiQ+pdkkZPUK0/K/OYfphLh2 UxKpf1zqvNOj4MgbfVrU1dYGvZhjOFIQkdzEW33iMHtcWSYknkTIVDWQKq605KPHeBSS SoHS2fB4JejDKK/TmOK3oMrBvNuonyLt5vqIJbuHo0/SSTmB7Ag+E7e0tawxrdfuLfXQ JhiQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b="fYSedm1/"; 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-196734-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196734-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57a31cca1b8si834048a12.665.2024.05.31.04.28.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 04:28:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-196734-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b="fYSedm1/"; 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-196734-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196734-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 93F261F2687B for ; Fri, 31 May 2024 11:27:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EB83B157486; Fri, 31 May 2024 11:27:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b="fYSedm1/" Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) (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 73F24745E7; Fri, 31 May 2024 11:27:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.149.25 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717154850; cv=none; b=mNiXF3ug3NZ/Wetvfvaw8Q0X/9EgXlcZdaoP/ZAXckZ044ZREQvhHa6/36BcEy7AEtJqijjWdYLRfsZBJYegIZYKJzBCVtna72OMbd5Cazm3gY96T+XIv8azdD5ZeL/salDp8N+YlFFK4h/OXqS+XyCF2RM45BXWpbNU1dNyYSY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717154850; c=relaxed/simple; bh=ir4kvqus4+b9A6TsrDobyBFHj6/X6jwrEM/lRyMJYGE=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=edu7GlaqKdblKZ8MyEWb6Qrzderp4O/ld5421Pn0eqJLvFCllFYWmvkwXFjgC9YbKIblCOjYBMVRHWG/+20WWCbomI8ejpw2oh+3l0aZh2u4PZXNfIzLmt2WDAURCxnZoEmOAInv81miXlukt8x8But42OLTxxcXXENSyZAXntA= 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=fYSedm1/; arc=none smtp.client-ip=67.231.149.25 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 (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44V6vAHn004232; Fri, 31 May 2024 06:27:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=cc :content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=PODMain02222019; bh=uqUvYOPYn4wZFfXt U6r/PgcMGfsmSJF3lS2+gb15emQ=; b=fYSedm1/p2UvZjvMBhJ6DMJb07bq0Ork iTixbRh21i5VmEyYK5GzLhMwrx+caF+pbf7BO2YMZUb5jx1SNMMvUnvAJfnjEt1s d2cvvTiZ+I4C8KG01CSdkHfPMC0BRf9OJPHRKogNQTDcDs/Hpx1enA1nVZGoE6TQ qaO5K7/H0uIi94UYzsPIw6wrUzbLjXsf96j10hm7I3k+EJxkitZjV2ZPYTTH/5qB 9dUz54SMG4SuKR9BIOi5HRyd/+0joIQELHwblsny2rk+eHEfMATn5Ea8uWON4oJ2 EmDGCgIX89lZtW0NeE+KpINf2Cq21nbFDLzjE+ERHa0tiZhuUJH/Rg== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3ybdcwwqa6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 31 May 2024 06:27:21 -0500 (CDT) Received: from ediex01.ad.cirrus.com (198.61.84.80) 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, 31 May 2024 12:27:19 +0100 Received: from ediswmail9.ad.cirrus.com (198.61.86.93) by anon-ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.2.1544.9 via Frontend Transport; Fri, 31 May 2024 12:27:19 +0100 Received: from EDIN6ZZ2FY3.ad.cirrus.com (EDIN6ZZ2FY3.ad.cirrus.com [198.61.65.72]) by ediswmail9.ad.cirrus.com (Postfix) with ESMTP id C5B9B820249; Fri, 31 May 2024 11:27:18 +0000 (UTC) From: Simon Trimmer To: CC: , , , , "Simon Trimmer" Subject: [PATCH] ALSA: hda: cs35l56: Fix lifecycle of codec pointer Date: Fri, 31 May 2024 12:27:16 +0100 Message-ID: <20240531112716.25323-1-simont@opensource.cirrus.com> X-Mailer: git-send-email 2.34.1 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-GUID: 8-xrWWee19RIF5fSr4rUExGKLCpecmYY X-Proofpoint-ORIG-GUID: 8-xrWWee19RIF5fSr4rUExGKLCpecmYY X-Proofpoint-Spam-Reason: safe The codec should be cleared when the amp driver is unbound and when resuming it should be tested to prevent loading firmware into the device and ALSA in a partially configured system state. Signed-off-by: Simon Trimmer --- sound/pci/hda/cs35l56_hda.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sound/pci/hda/cs35l56_hda.c b/sound/pci/hda/cs35l56_hda.c index 11b0570ff56d..0923e2589f5f 100644 --- a/sound/pci/hda/cs35l56_hda.c +++ b/sound/pci/hda/cs35l56_hda.c @@ -735,6 +735,8 @@ static void cs35l56_hda_unbind(struct device *dev, struct device *master, void * if (comps[cs35l56->index].dev == dev) memset(&comps[cs35l56->index], 0, sizeof(*comps)); + cs35l56->codec = NULL; + dev_dbg(cs35l56->base.dev, "Unbound\n"); } @@ -840,6 +842,9 @@ static int cs35l56_hda_system_resume(struct device *dev) cs35l56->suspended = false; + if (!cs35l56->codec) + return 0; + ret = cs35l56_is_fw_reload_needed(&cs35l56->base); dev_dbg(cs35l56->base.dev, "fw_reload_needed: %d\n", ret); if (ret > 0) { -- 2.34.1