Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3990212rdh; Fri, 29 Sep 2023 08:08:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHa2MNcT6W0kGGv+NfdlvTSC4du6CcLI78ffDfM92UqKBXbnjIQ19A6Ea0NHXLh+HCVLeI7 X-Received: by 2002:a05:6a21:186:b0:15d:d250:d240 with SMTP id le6-20020a056a21018600b0015dd250d240mr4970173pzb.50.1696000139368; Fri, 29 Sep 2023 08:08:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696000139; cv=none; d=google.com; s=arc-20160816; b=zKUDefn7fS4qKbMug62DRlUa2/V6+qxpM6CD/tWB5gcaBEdD1XNbzqmgR95YZ/qlxs 2K//5aIGV424nafKBZpTNBfBBkS0624I0CF2CXit2L5p+K6vEGilmqDCJZky9sZiAXt8 W0O8+mo0hg/yXZ8Ew5IrcP+CEXdsX8izaj1rNKugGltxfM9ymD8P05pu3G4q50PftmoP GAxH+jHb+i5+Ucb6KatIkBKCYQXnCbaR5bKVo+5OjbjNCSRm4LQvGe7hUmHuFcruRRLo IHK27rXktC4yOFVkz+e05sJ9Ent5gyy6ua3fsozxYXrLGFHLwtHoIQlwWAkIFitU2BOg iO4w== 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=RhKQWq1cIZgJ/o3XaqUIcIo4tsGDDmj107A8gMA0SWQ=; fh=gSlqDyTAaX4sD5o7lNdgN6GT1mkO6Z4/Ye0T8jAhwnM=; b=awfMvvJmxGw5Ik1exP4EEq57A1CvKx/uPp8kXomNr53VSkgd/P3h7nSSJlEaFmmeIj ltNihPorD7QVmyfjfSAdvqaGulshoN0VxPYQxQchJlfzwOGn6TLOZuSoOA9HB9JPRBdD 1bWcjDXBf98pRVMi+XBy9cQ159pz8diKaOvuutqt8oD6lYfyPt7PD7B7tu29wu7DM8/9 +R5ZobEw+YUWvcVloR79cyVCfFO9Z8LeOjpdIueYBLiyZfqtCaC8cALp4vcxnlB8E8lv uAtwJJmLtkUrsJGYM+TV1OoXokq13lpbpw3aEPo1MgdMUlX2+lcypWD4Y8olfFfhdTLr VG1w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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. [23.128.96.31]) by mx.google.com with ESMTPS id l190-20020a6388c7000000b00565325c6ca6si21075336pgd.489.2023.09.29.08.08.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 08:08:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 D7958801F9B1; Fri, 29 Sep 2023 07:51:49 -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 S233147AbjI2Ovj (ORCPT + 99 others); Fri, 29 Sep 2023 10:51:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229545AbjI2Ovi (ORCPT ); Fri, 29 Sep 2023 10:51:38 -0400 Received: from mblankhorst.nl (lankhorst.se [141.105.120.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 445FDF9 for ; Fri, 29 Sep 2023 07:51:36 -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 v5 01/12] ASoC/SOF/core: Ensure sof_ops_free() is still called when probe never ran. Date: Fri, 29 Sep 2023 16:51:15 +0200 Message-Id: <20230929145123.233838-2-maarten.lankhorst@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230929145123.233838-1-maarten.lankhorst@linux.intel.com> References: <20230929145123.233838-1-maarten.lankhorst@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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]); Fri, 29 Sep 2023 07:51:50 -0700 (PDT) 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 --- 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