From patchwork Fri May 30 07:52:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarkko Nikula X-Patchwork-Id: 4268981 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DDE21BEEA7 for ; Fri, 30 May 2014 07:54:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0D33A2037E for ; Fri, 30 May 2014 07:54:54 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 9D0F920357 for ; Fri, 30 May 2014 07:54:52 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 7A148262618; Fri, 30 May 2014 09:54:43 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 53969261B19; Fri, 30 May 2014 09:54:32 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 3D0A2261685; Fri, 30 May 2014 09:54:31 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by alsa0.perex.cz (Postfix) with ESMTP id 80AED261685 for ; Fri, 30 May 2014 09:54:22 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 30 May 2014 00:54:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.98,939,1392192000"; d="scan'208";a="547175362" Received: from mylly.fi.intel.com (HELO mylly.fi.intel.com.) ([10.237.72.152]) by fmsmga002.fm.intel.com with ESMTP; 30 May 2014 00:53:30 -0700 From: Jarkko Nikula To: alsa-devel@alsa-project.org Date: Fri, 30 May 2014 10:52:29 +0300 Message-Id: <1401436349-19202-1-git-send-email-jarkko.nikula@linux.intel.com> X-Mailer: git-send-email 2.0.0.rc2 Cc: Liam Girdwood , Imre Deak , Mark Brown , Jarkko Nikula , Liam Girdwood Subject: [alsa-devel] [PATCH] ASoC: Intel: byt/hsw: Add missing kthread_stop to error/cleanup path X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Imre Deak Baytrail and Haswell SST IPC don't stop the kernel thread in error and cleanup path thus leaving orphan kernel thread behind in such a case. Also while at it, fix one error path in sst-haswell-ipc.c that doesn't free hsw->msg. [Jarkko: I edited the commit log a little] Signed-off-by: Imre Deak Signed-off-by: Jarkko Nikula --- sound/soc/intel/sst-baytrail-ipc.c | 5 ++++- sound/soc/intel/sst-haswell-ipc.c | 12 ++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/sound/soc/intel/sst-baytrail-ipc.c b/sound/soc/intel/sst-baytrail-ipc.c index 0d31dbbf4806..d4b8c827c8b8 100644 --- a/sound/soc/intel/sst-baytrail-ipc.c +++ b/sound/soc/intel/sst-baytrail-ipc.c @@ -824,7 +824,7 @@ int sst_byt_dsp_init(struct device *dev, struct sst_pdata *pdata) byt->dsp = sst_dsp_new(dev, &byt_dev, pdata); if (byt->dsp == NULL) { err = -ENODEV; - goto err_free_msg; + goto dsp_err; } /* keep the DSP in reset state for base FW loading */ @@ -856,6 +856,8 @@ boot_err: sst_fw_free(byt_sst_fw); fw_err: sst_dsp_free(byt->dsp); +dsp_err: + kthread_stop(byt->tx_thread); err_free_msg: kfree(byt->msg); @@ -870,6 +872,7 @@ void sst_byt_dsp_free(struct device *dev, struct sst_pdata *pdata) sst_dsp_reset(byt->dsp); sst_fw_free_all(byt->dsp); sst_dsp_free(byt->dsp); + kthread_stop(byt->tx_thread); kfree(byt->msg); } EXPORT_SYMBOL_GPL(sst_byt_dsp_free); diff --git a/sound/soc/intel/sst-haswell-ipc.c b/sound/soc/intel/sst-haswell-ipc.c index e7996b39a484..bee192d42032 100644 --- a/sound/soc/intel/sst-haswell-ipc.c +++ b/sound/soc/intel/sst-haswell-ipc.c @@ -1730,7 +1730,7 @@ int sst_hsw_dsp_init(struct device *dev, struct sst_pdata *pdata) ret = msg_empty_list_init(hsw); if (ret < 0) - goto list_err; + return -ENOMEM; /* start the IPC message thread */ init_kthread_worker(&hsw->kworker); @@ -1740,7 +1740,7 @@ int sst_hsw_dsp_init(struct device *dev, struct sst_pdata *pdata) if (IS_ERR(hsw->tx_thread)) { ret = PTR_ERR(hsw->tx_thread); dev_err(hsw->dev, "error: failed to create message TX task\n"); - goto list_err; + goto err_free_msg; } init_kthread_work(&hsw->kwork, ipc_tx_msgs); @@ -1750,7 +1750,7 @@ int sst_hsw_dsp_init(struct device *dev, struct sst_pdata *pdata) hsw->dsp = sst_dsp_new(dev, &hsw_dev, pdata); if (hsw->dsp == NULL) { ret = -ENODEV; - goto list_err; + goto dsp_err; } /* keep the DSP in reset state for base FW loading */ @@ -1794,8 +1794,11 @@ boot_err: sst_fw_free(hsw_sst_fw); fw_err: sst_dsp_free(hsw->dsp); +dsp_err: + kthread_stop(hsw->tx_thread); +err_free_msg: kfree(hsw->msg); -list_err: + return ret; } EXPORT_SYMBOL_GPL(sst_hsw_dsp_init); @@ -1808,6 +1811,7 @@ void sst_hsw_dsp_free(struct device *dev, struct sst_pdata *pdata) sst_fw_free_all(hsw->dsp); sst_dsp_free(hsw->dsp); kfree(hsw->scratch); + kthread_stop(hsw->tx_thread); kfree(hsw->msg); } EXPORT_SYMBOL_GPL(sst_hsw_dsp_free);