Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1838994rdb; Mon, 9 Oct 2023 04:55:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH83/n83hPnvlYOiUvoZ3XMKeh6GraCd4h1aPKm8D3ETHWmXzpZG0Zq6yzDAoWSfJ0udZ3w X-Received: by 2002:a05:6358:3421:b0:14d:bad5:6adf with SMTP id h33-20020a056358342100b0014dbad56adfmr16502416rwd.21.1696852538485; Mon, 09 Oct 2023 04:55:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696852538; cv=none; d=google.com; s=arc-20160816; b=R4+9S/W71XRRlMXadKBtxeasq0zXMv3ivNlxLBUfcvbCu7UAK6U9RM44Q1g2mzao9R pu1VXkm/G1eHMymwkvIrz9Ng7z/o8jTZDS0zdeEHViLqjEIJnVOncvVhxt+1e5LZQdXO rRIRN0Pq7S7XT1sXqWH2YZc3LGlKxsvoizL4yD0LrEFGD9dG6Fu8hxjRBo/Tsn/vb+3S 4UecnGsTEIpGY2npYRadEgkemdr5FhRq8FSXIc1GlA12sc5OORpK8G+L2ah27V8KGiRV inSm2xlvv9lNc0MjXts+VK16ygcQh3vakdQ3ns45/1uIYwXif4/E/u+Ud6xPrlqtxHOv T8SQ== 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=x1UvlSxH2pT+VxWhjEqbWA71yD3Va9SxhDl430P6ie0=; fh=gSlqDyTAaX4sD5o7lNdgN6GT1mkO6Z4/Ye0T8jAhwnM=; b=FMsKGwhuu61Uo3uinmDBMI4hrD8AcQi9AZclscVyl8nWG+aQw9Ml0xqnOgxPVVOnFC NBurjG1c3FBgglQ2GpudTKaN+aE8xkDuTMZ1QH0hyuhyzIcxJCoPOguklIxUiycQhhJu tZEPDKzM+9o1Iz8h6iG3LssmSyXh+QTUJGfE0nQXxjv/sQ9M77/m2a5Q7gk4kNQK2N6e tP7OeHVrrMbcmQv8AQ4lbiZioclKt6yh0cHBZITV9QreRwVPn50oajCmKppM/7km18GH w1IOOb6f9udWALLHz9dUzYmdBD2IyvqCWf8WB3iSw3mZd4WzfEU4WmzPS+df7PGcvdRm XRmA== 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:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id w11-20020a17090abc0b00b00278f79e4fabsi11313307pjr.93.2023.10.09.04.55.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 04:55:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 3421880205C0; Mon, 9 Oct 2023 04:55:22 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346388AbjJILyx (ORCPT + 99 others); Mon, 9 Oct 2023 07:54:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346341AbjJILyr (ORCPT ); Mon, 9 Oct 2023 07:54:47 -0400 Received: from mblankhorst.nl (lankhorst.se [141.105.120.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0889AB for ; Mon, 9 Oct 2023 04:54:44 -0700 (PDT) From: Maarten Lankhorst To: alsa-devel@alsa-project.org Cc: Maarten Lankhorst , Jaroslav Kysela , Takashi Iwai , Cezary Rojewski , Pierre-Louis Bossart , Liam Girdwood , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Kai Vehmanen , Mark Brown , Daniel Baluta , linux-kernel@vger.kernel.org, sound-open-firmware@alsa-project.org Subject: [PATCH v7 01/13] ASoC: SOF: core: Ensure sof_ops_free() is still called when probe never ran. Date: Mon, 9 Oct 2023 13:54:25 +0200 Message-Id: <20231009115437.99976-2-maarten.lankhorst@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231009115437.99976-1-maarten.lankhorst@linux.intel.com> References: <20231009115437.99976-1-maarten.lankhorst@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.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 (morse.vger.email [0.0.0.0]); Mon, 09 Oct 2023 04:55:22 -0700 (PDT) X-Spam-Level: ** In an effort to not call sof_ops_free twice, we stopped running it when probe was aborted. Check the result of cancel_work_sync to see if this was the case. Fixes: 31bb7bd9ffee ("ASoC: SOF: core: Only call sof_ops_free() on remove if the probe was successful") Cc: Peter Ujfalusi Acked-by: Mark Brown --- sound/soc/sof/core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sound/soc/sof/core.c b/sound/soc/sof/core.c index 2d1616b81485c..0938b259f7034 100644 --- a/sound/soc/sof/core.c +++ b/sound/soc/sof/core.c @@ -459,9 +459,10 @@ int snd_sof_device_remove(struct device *dev) struct snd_sof_dev *sdev = dev_get_drvdata(dev); struct snd_sof_pdata *pdata = sdev->pdata; int ret; + bool aborted = false; if (IS_ENABLED(CONFIG_SND_SOC_SOF_PROBE_WORK_QUEUE)) - cancel_work_sync(&sdev->probe_work); + aborted = cancel_work_sync(&sdev->probe_work); /* * Unregister any registered client device first before IPC and debugfs @@ -487,6 +488,9 @@ int snd_sof_device_remove(struct device *dev) snd_sof_free_debug(sdev); snd_sof_remove(sdev); sof_ops_free(sdev); + } else if (aborted) { + /* probe_work never ran */ + sof_ops_free(sdev); } /* release firmware */ -- 2.39.2