From patchwork Mon Jun 18 12:00:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 10471427 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BC15A6032A for ; Mon, 18 Jun 2018 13:32:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA824289D3 for ; Mon, 18 Jun 2018 13:32:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9DDC8289E5; Mon, 18 Jun 2018 13:32:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 358F3289D3 for ; Mon, 18 Jun 2018 13:32:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Date:Message-Id: In-Reply-To:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: References:List-Owner; bh=dD3dKoDuXvqPxwTQFL8GpV2Pk0mD/twjR7OYmTE37RY=; b=azO zUXA4A/Sslw7u0pb65Nh2fiNY9ubhZ3PxG26wHbgg+89cshH5ThR9nNaj5D9rkE+9pcObUKiM13gq h6PGwDOTrOLg5C55yonKSflLI5ydZZuEvnM9Vj7g2WePN7E+HsX6aegb69RKhtCdVmOh2oS7U5xtc o8M6viJL6VKEcVE+0WWNsg7EoJWibMFM8kaGyT1CBSIz5clPeJAIj2qSxyqagTqr9heI4HzBetMFo jOjkUe/xX5w48mIf9yp1GMEaQGOLmmr8VRFGoeDYM6nerTiiQ6E8bqoeXeDpy6rLZTV6RxTiapWfB oGgqODf52ILOZ4Cmdug5fRd5n5k7udA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fUuGu-00030L-U2; Mon, 18 Jun 2018 13:32:40 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fUtqk-0005ah-42 for linux-rockchip@bombadil.infradead.org; Mon, 18 Jun 2018 13:05:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Date:Message-Id:In-Reply-To:Subject:Cc: To:From:Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:References:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=cODi900G5xOZ0pXRFs7Lle3IzqrbKHVoAbh19dn8oYo=; b=IUuD3TZI7Ytyx/xzEVZjiTX+LV snLbQtiQb8EK1lQroQ0J6ZT9tmxZRkJQ9FIm/jtaM+aYPlFatk7gZqIFZivqIaSpiJu6prrhBXwfB 9iG+wVkLHaa68/fpaHWh/YNJbyl3XcXfrRafpfpA8lpFibPNTcYf/JEDGju8PEDC9RUv2Hx180ipH EI0ATn6/6jIUNwDzpnWSBTrisjW9JSl0Vg/sk+FcJ0mrPe4BHoADiOUOhNABLCqVvOwaqr1cgZDBw b6AcqOX5EBD08Pd/oRhQ2kmkBUpy1uSVxWkgaoK3cFf6vn/9zqgIlFFZLairdpLz/Ix7VipeCvxza 7L63q3GA==; Received: from heliosphere.sirena.org.uk ([2a01:7e01::f03c:91ff:fed4:a3b6]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fUsq0-0004ua-CP for linux-rockchip@lists.infradead.org; Mon, 18 Jun 2018 12:00:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=cODi900G5xOZ0pXRFs7Lle3IzqrbKHVoAbh19dn8oYo=; b=FJYs9NsuyDX3 VK/951n25ukAnIfvtLLN1lir0XtqOQF/UA8TgMuJuj++X700eLAERP5YWaxoziMqf0niEVqsPgb+h kwb+1KqCzQhol8NQL5wRqwCYY++F/37SQzHZmAb3brcVMVUNF/1iaIuXaIG/bHpXKUFNvLgDaG6O2 G4pyY=; Received: from debutante.sirena.org.uk ([2001:470:1f1d:6b5::3] helo=debutante) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1fUspa-0007yo-MX; Mon, 18 Jun 2018 12:00:22 +0000 Received: from broonie by debutante with local (Exim 4.91) (envelope-from ) id 1fUspa-0000EU-8H; Mon, 18 Jun 2018 13:00:22 +0100 From: Mark Brown To: Alexey Khoroshilov Subject: Applied "ASoC: rockchip: put device_node on remove" to the asoc tree In-Reply-To: <1528582854-8402-1-git-send-email-khoroshilov@ispras.ru> Message-Id: Date: Mon, 18 Jun 2018 13:00:22 +0100 X-Bad-Reply: In-Reply-To but no 'Re:' in Subject. X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180618_080048_549132_8FE77E86 X-CRM114-Status: GOOD ( 15.69 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ldv-project@linuxtesting.org, alsa-devel@alsa-project.org, Heiko Stuebner , linux-rockchip@lists.infradead.org, sil2review@lists.osadl.org, Takashi Iwai , Liam Girdwood , linux-kernel@vger.kernel.org, Julia Lawall , Mark Brown MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The patch ASoC: rockchip: put device_node on remove has been applied to the asoc tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark From a56df73ba5960848f60f609c68770d2638bf1dd5 Mon Sep 17 00:00:00 2001 From: Alexey Khoroshilov Date: Sun, 10 Jun 2018 01:20:54 +0300 Subject: [PATCH] ASoC: rockchip: put device_node on remove snd_rk_mc_probe() gets a couple of device nodes with of_parse_phandle(), but there is no release of them. The patch adds remove handler and proper error handling in the probe. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov Signed-off-by: Mark Brown --- sound/soc/rockchip/rockchip_rt5645.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/sound/soc/rockchip/rockchip_rt5645.c b/sound/soc/rockchip/rockchip_rt5645.c index 4db4fd56db35..881c32498808 100644 --- a/sound/soc/rockchip/rockchip_rt5645.c +++ b/sound/soc/rockchip/rockchip_rt5645.c @@ -181,7 +181,8 @@ static int snd_rk_mc_probe(struct platform_device *pdev) if (!rk_dailink.cpu_of_node) { dev_err(&pdev->dev, "Property 'rockchip,i2s-controller' missing or invalid\n"); - return -EINVAL; + ret = -EINVAL; + goto put_codec_of_node; } rk_dailink.platform_of_node = rk_dailink.cpu_of_node; @@ -190,17 +191,36 @@ static int snd_rk_mc_probe(struct platform_device *pdev) if (ret) { dev_err(&pdev->dev, "Soc parse card name failed %d\n", ret); - return ret; + goto put_cpu_of_node; } ret = devm_snd_soc_register_card(&pdev->dev, card); if (ret) { dev_err(&pdev->dev, "Soc register card failed %d\n", ret); - return ret; + goto put_cpu_of_node; } return ret; + +put_cpu_of_node: + of_node_put(rk_dailink.cpu_of_node); + rk_dailink.cpu_of_node = NULL; +put_codec_of_node: + of_node_put(rk_dailink.codec_of_node); + rk_dailink.codec_of_node = NULL; + + return ret; +} + +static int snd_rk_mc_remove(struct platform_device *pdev) +{ + of_node_put(rk_dailink.cpu_of_node); + rk_dailink.cpu_of_node = NULL; + of_node_put(rk_dailink.codec_of_node); + rk_dailink.codec_of_node = NULL; + + return 0; } static const struct of_device_id rockchip_rt5645_of_match[] = { @@ -212,6 +232,7 @@ MODULE_DEVICE_TABLE(of, rockchip_rt5645_of_match); static struct platform_driver snd_rk_mc_driver = { .probe = snd_rk_mc_probe, + .remove = snd_rk_mc_remove, .driver = { .name = DRV_NAME, .pm = &snd_soc_pm_ops,