Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4010902ybl; Mon, 3 Feb 2020 10:47:56 -0800 (PST) X-Google-Smtp-Source: APXvYqwIk/lEZPfy9LsrmVnrQmEbSFhYh/5TNKCza3F1lnNsAUD+AB4I/RFn5+VFWVS9IMst+vCL X-Received: by 2002:aca:ea43:: with SMTP id i64mr342754oih.30.1580755676201; Mon, 03 Feb 2020 10:47:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580755676; cv=none; d=google.com; s=arc-20160816; b=uza/YQmrzEZT7+G1tTPgKa8/CgtiPYeHkJKZMr+J3wOIogj1P+Rk6J8hICEhfSv+RE WNKY2NKGmo7YDuNUEi+Y9fL2FWjIFWw1T5Co6wsWa9rLvfXIVR0XPdGIIypRYjVFZpK5 GvQe1SsPgfATdhUUYRmLd5zfBfukBZXCnJGqCHYDSl61itEuZ1bXmaBu/7/qJod39peB lH8tY3BgouisH8xeHnpufYxZ9Mks1Io1eLdjhZTWk1OrnjqVt8oM8eOyMqJxB3Jxwine vBL7HbIqpJvh1geIeyfcUII6ZWkh5HPRyi216od8ggVhcqF3Q4jLszJRcYqYHQEfY9ep gajg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5PYL2C+nAnb1Bd8a7VVRPyo5UESiO8PCi5dwi79Nz0A=; b=cwH9+ou9Wg48XxVIA2pv6hKLpSXuq5cZNpGUTkRNZ9bN4R5ZDhIMGQO8MTnhZgLIpa blHxX0HlkchCfWW1BmwDyIP32DAcTfrucj/UTfcyvuqBokKmhkcd80wYktCVeQx95IV/ 60CiDZuBVecGS3v/jzAR9QNOjFG4HetomsQSl6eplVHIxwcDefUHSBzqZ8KPro+SQSc/ aaMqC77QIY1NlY/c6SDryNJEf/bzwf3HmPTZnqH3Azp+8HGqljpn9ZeLCVok76dweNf1 X5dsW5DJi38OLFjGgPuxoA2Hm1Cjkdqds0WMUmcGTRpzXiVp1pgbZmiS1AAT2QrK5xcY ZXfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=S7x8RZCu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p23si4279598otk.119.2020.02.03.10.47.44; Mon, 03 Feb 2020 10:47:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=S7x8RZCu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730987AbgBCQfi (ORCPT + 98 others); Mon, 3 Feb 2020 11:35:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:50446 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730974AbgBCQfe (ORCPT ); Mon, 3 Feb 2020 11:35:34 -0500 Received: from localhost (unknown [104.132.45.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AD29A2051A; Mon, 3 Feb 2020 16:35:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580747734; bh=2dCeTe+htp6bYLj6TEvc7v6Uv3nrYBGHsJ2ytgCOJwM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S7x8RZCuj+2mg1GpYwwG5cTAfCGNRSvfBD4oB9nR/lyGd/nwu2UU+nN9seHRWkKEs Yld1kmrnHD/IL/ZuzC091t8m0Lq8ZYSo3u1vAHv+mbIimnINJfd/izpv144ElWO9BI UWMkWSI+ni2moaDXtF0mAgtlIDmuHvxciaNuEC7k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kai Vehmanen , Pierre-Louis Bossart , Mark Brown , Sasha Levin Subject: [PATCH 5.4 46/90] ASoC: hdac_hda: Fix error in driver removal after failed probe Date: Mon, 3 Feb 2020 16:19:49 +0000 Message-Id: <20200203161923.638680544@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200203161917.612554987@linuxfoundation.org> References: <20200203161917.612554987@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kai Vehmanen [ Upstream commit 552b1a85da9f63856e7e341b81c16e0e078204f1 ] In case system has multiple HDA codecs, and codec probe fails for at least one but not all codecs, driver will end up cancelling a non-initialized timer context upon driver removal. Call trace of typical case: [ 60.593646] WARNING: CPU: 1 PID: 1147 at kernel/workqueue.c:3032 __flush_work+0x18b/0x1a0 [...] [ 60.593670] __cancel_work_timer+0x11f/0x1a0 [ 60.593673] hdac_hda_dev_remove+0x25/0x30 [snd_soc_hdac_hda] [ 60.593674] device_release_driver_internal+0xe0/0x1c0 [ 60.593675] bus_remove_device+0xd6/0x140 [ 60.593677] device_del+0x175/0x3e0 [ 60.593679] ? widget_tree_free.isra.7+0x90/0xb0 [snd_hda_core] [ 60.593680] snd_hdac_device_unregister+0x34/0x50 [snd_hda_core] [ 60.593682] snd_hdac_ext_bus_device_remove+0x2a/0x60 [snd_hda_ext_core] [ 60.593684] hda_dsp_remove+0x26/0x100 [snd_sof_intel_hda_common] [ 60.593686] snd_sof_device_remove+0x84/0xa0 [snd_sof] [ 60.593687] sof_pci_remove+0x10/0x30 [snd_sof_pci] [ 60.593689] pci_device_remove+0x36/0xb0 Signed-off-by: Kai Vehmanen Signed-off-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20200110235751.3404-9-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/hdac_hda.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/hdac_hda.c b/sound/soc/codecs/hdac_hda.c index 4570f662fb48b..d78f4d856aaff 100644 --- a/sound/soc/codecs/hdac_hda.c +++ b/sound/soc/codecs/hdac_hda.c @@ -498,7 +498,9 @@ static int hdac_hda_dev_remove(struct hdac_device *hdev) struct hdac_hda_priv *hda_pvt; hda_pvt = dev_get_drvdata(&hdev->dev); - cancel_delayed_work_sync(&hda_pvt->codec.jackpoll_work); + if (hda_pvt && hda_pvt->codec.registered) + cancel_delayed_work_sync(&hda_pvt->codec.jackpoll_work); + return 0; } -- 2.20.1