Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1932463ybl; Tue, 3 Dec 2019 15:13:42 -0800 (PST) X-Google-Smtp-Source: APXvYqwDkb6ueWsxs4y14R6h9h3TI0kz9VkMDajC6mudzZxD4OPl+gpa62y9oyqAoSf0qKxt0nqY X-Received: by 2002:a05:6830:20d3:: with SMTP id z19mr291063otq.330.1575414822238; Tue, 03 Dec 2019 15:13:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575414822; cv=none; d=google.com; s=arc-20160816; b=UoOFyQfPLrrt7Za+9okJrZrxsyTVZbjBB7NnZWYf/VVPBk5nEGQoUabakCz9BZYsif wmg+eniki1TyLf27u7RE7qn5urfy7c9VhrWJr7oyipuGcrI5d9aJnBkL7f8BtI3J4gZe 2SpkYQCLR0PU0rHCFRuQDK7T3a2w0NUVTWrI187x2CMWgy+lHd8sX3nqOwtpIZoOuO7X 8rbiNDoM19D1Iuv+MFIRynfHwMWLt/v5IWDYjzzOQje5/l8BW46wc12zrqxcQ8Kzg/bi NPcEsA10XbZD7wvEcbx059FvZybnsqzJt2NChVuM4sCg0ULttaKqRftPuAtq96OLVUQQ n64Q== 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=jIU6xeYFwvOh+LSQ6iy+XO0/t8/yOp1vlpKSwyN6PWU=; b=V/9ABPZ0rbESM4sKplfBn5J9e3h2UpNtFy2gb6XR9IWBrqQKkVtNph6cPcEPP/DwzN MSclV+4+apLLr9X728p4QDV72vvlExBMpCs++GzTkctwgxS+5NpciDISf/zc1ozrotM0 gWhpwEeDpdB2W67ixulsHxUFkgbek7ExSWoWgKxTFMaag0p3ivq+Z14m2Z/I4o/fsNrk CmSCuGeKZ8KK8t019ubMoe1kkasYDvtnYEvAXL/iYrEMX73RFrgLD471n2M7yv3ysYez dHtM3dNUFli+H4gJVamB0qb3bep5P4vxpikZMEYDAnlI9UCzNU3S/rDoF4rzjtl0dz43 50lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rgXFbPpA; 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 8si1985628ota.266.2019.12.03.15.13.30; Tue, 03 Dec 2019 15:13:42 -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=rgXFbPpA; 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 S1728299AbfLCWjt (ORCPT + 99 others); Tue, 3 Dec 2019 17:39:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:50588 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727967AbfLCWjr (ORCPT ); Tue, 3 Dec 2019 17:39:47 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 7CA062080F; Tue, 3 Dec 2019 22:39:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575412786; bh=bfJajeQIb8sijPheFihRNFkc21fQtvyr5jOXGk+0Q/Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rgXFbPpAoullQmKd+0BRTaAkHr2eeALRyfrFz1xMUBHTiV4JsgUz9jRCqBpuiOPYL OBJvZKIDu5G8Lq2kDezjN9KhumU/WiVpyo7cVCs8bQs8ri0BahNgqR6E7IhR2y34Dm +JUc0N8D1ZD7LVcOtcyyCmfx+AIxsOktOovC6QHs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Russell King , Mark Brown , Sasha Levin Subject: [PATCH 5.3 017/135] ASoC: kirkwood: fix device remove ordering Date: Tue, 3 Dec 2019 23:34:17 +0100 Message-Id: <20191203213009.198177109@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191203213005.828543156@linuxfoundation.org> References: <20191203213005.828543156@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: Russell King [ Upstream commit dc39596a906d5b604f4e64597b6e904fc14625e8 ] The devm conversion of kirkwood was incorrect; on removal, devm takes effect after the "remove" function has returned. So, the effect of the conversion was to change the order during remove from: - snd_soc_unregister_component() (unpublishes interfaces) - clk_disable_unprepare() - cleanup resources After the conversion, this became: - clk_disable_unprepare() - while the device may still be active - snd_soc_unregister_component() - cleanup resources Hence, it introduces a bug, where the internal clock for the device may be shut down before the device itself has been shut down. It is known that Marvell SoCs, including Dove, locks up if registers for a peripheral that has its clocks disabled are accessed. Fixes: f98fc0f8154e ("ASoC: kirkwood: replace platform to component") Signed-off-by: Russell King Link: https://lore.kernel.org/r/E1iNGyP-0004oN-BA@rmk-PC.armlinux.org.uk Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/kirkwood/kirkwood-i2s.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/soc/kirkwood/kirkwood-i2s.c b/sound/soc/kirkwood/kirkwood-i2s.c index c323ae314b554..eb38cdb37f0ea 100644 --- a/sound/soc/kirkwood/kirkwood-i2s.c +++ b/sound/soc/kirkwood/kirkwood-i2s.c @@ -591,7 +591,7 @@ static int kirkwood_i2s_dev_probe(struct platform_device *pdev) priv->ctl_rec |= KIRKWOOD_RECCTL_BURST_128; } - err = devm_snd_soc_register_component(&pdev->dev, &kirkwood_soc_component, + err = snd_soc_register_component(&pdev->dev, &kirkwood_soc_component, soc_dai, 2); if (err) { dev_err(&pdev->dev, "snd_soc_register_component failed\n"); @@ -614,6 +614,7 @@ static int kirkwood_i2s_dev_remove(struct platform_device *pdev) { struct kirkwood_dma_data *priv = dev_get_drvdata(&pdev->dev); + snd_soc_unregister_component(&pdev->dev); if (!IS_ERR(priv->extclk)) clk_disable_unprepare(priv->extclk); clk_disable_unprepare(priv->clk); -- 2.20.1