From patchwork Tue Feb 19 15:19:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 10820027 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1ADA4180E for ; Tue, 19 Feb 2019 15:20:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0197A2C109 for ; Tue, 19 Feb 2019 15:20:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F3FEE2C844; Tue, 19 Feb 2019 15:20:34 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 119B02C109 for ; Tue, 19 Feb 2019 15:20:28 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id F3950265535; Tue, 19 Feb 2019 16:20:21 +0100 (CET) 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 9D9F3265535; Tue, 19 Feb 2019 16:20:19 +0100 (CET) Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by alsa0.perex.cz (Postfix) with ESMTP id EA68F265525 for ; Tue, 19 Feb 2019 16:20:15 +0100 (CET) Received: from epcas1p1.samsung.com (unknown [182.195.41.45]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20190219152012epoutp019d63d8fd48c21163512c9c38d6c72aba~EzQmiagLt0260402604epoutp01f; Tue, 19 Feb 2019 15:20:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20190219152012epoutp019d63d8fd48c21163512c9c38d6c72aba~EzQmiagLt0260402604epoutp01f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1550589613; bh=JHwTFh48S3B1ikB/OlwFRSfz4YrSAVRhOCixy70VD3o=; h=From:To:Cc:Subject:Date:References:From; b=bb7HqXatc3UauPYqZqIYhQIMjTJaZDE16BZHJDkl9sMtR5oKoZUMxl5z0qtnltLxI yaq+Y/nPDiDb2SIo9Wo4kyqsMK2NkI/uRPJdpNlDimNDsQrpG9erx4n5DIdCYkHicQ S5TPtRunzfvwDg1RAh9M4u1HGGkQ+1J3sckqGoOw= Received: from epsmges1p2.samsung.com (unknown [182.195.42.54]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20190219152012epcas1p29632b37ef8d3f9b369a210af24322c64~EzQmHxTuy2097420974epcas1p2O; Tue, 19 Feb 2019 15:20:12 +0000 (GMT) Received: from epcas1p4.samsung.com ( [182.195.41.48]) by epsmges1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 38.7B.04173.CAE1C6C5; Wed, 20 Feb 2019 00:20:12 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20190219152012epcas1p4df1d6e4f6439ab05de95c089a4416e06~EzQlol-A20144401444epcas1p4_; Tue, 19 Feb 2019 15:20:12 +0000 (GMT) X-AuditID: b6c32a36-5d9ff7000000104d-7f-5c6c1eacd5ad Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 07.72.04015.BAE1C6C5; Wed, 20 Feb 2019 00:20:11 +0900 (KST) Received: from AMDC3061.digital.local ([106.116.147.40]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PN600EUVIL44F30@mmp1.samsung.com>; Wed, 20 Feb 2019 00:20:11 +0900 (KST) From: Sylwester Nawrocki To: broonie@kernel.org, lgirdwood@gmail.com Date: Tue, 19 Feb 2019 16:19:40 +0100 Message-id: <20190219151941.9795-1-s.nawrocki@samsung.com> X-Mailer: git-send-email 2.17.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprDIsWRmVeSWpSXmKPExsWy7bCmge4auZwYg5bvchZXLh5istg4Yz2r xdSHT9gszp/fwG7x7UoHk8XlXXPYLGac38dksfbIXXaLw2/aWS0urvjC5MDlseFzE5vHzll3 2T02repk8+jbsorR4/MmuQDWKC6blNSczLLUIn27BK6Mhj8fmAo6RSou3zvL3sB4VaCLkZND QsBE4v/TeUwgtpDADkaJAz+tIezvjBLvtmjB1Hy70czWxcgFFN/NKPHr6Uwo5xejxNaD11lB qtgEDCV6j/YxgtgiAtoSc252gBUxC7xllJj3bBdQEQeHsECUxOflYDUsAqoSb3b8YgaxeQWs JB4cbmaB2CYvsXrDAWaQXgmBDjaJzz/Xs0EkXCS+tb5kA5kjISAtcemoLUS4WmLX9m6YekaJ lgvbmSES1hKHj18EO45ZgE/i3dceVoheXomONiGIEg+JE8++s0B8HCsxc8ETpgmM4gsYGVYx iqUWFOempxYbFhjpFSfmFpfmpesl5+duYgTHmZbZDsZF53wOMQpwMCrx8Gow5MQIsSaWFVfm HmKU4GBWEuE15AIK8aYkVlalFuXHF5XmpBYfYpTmYFES513v4BwjJJCeWJKanZpakFoEk2Xi 4JRqYKzy0BHwTwjuab3l/vloa+G0uYfr3179O/FPxccC64m6XJ4x90u7Fr11DnwR1Zer7nCc 4fMNLfnls7OCpzV0BJWsmXL17/5307wcglu+PDf4Karalrb/luTP92ktogZ/Jib47ufQU4lk nvM3PjZUKPmoXXLvmzf6L9OyKhI+KNe/ZJl0JsjCWomlOCPRUIu5qDgRAMIT88+vAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpmluLIzCtJLcpLzFFi42I5/e+xgO5quZwYgxV/LS2uXDzEZLFxxnpW i6kPn7BZnD+/gd3i25UOJovLu+awWcw4v4/JYu2Ru+wWh9+0s1pcXPGFyYHLY8PnJjaPnbPu sntsWtXJ5tG3ZRWjx+dNcgGsUVw2Kak5mWWpRfp2CVwZDX8+MBV0ilRcvneWvYHxqkAXIyeH hICJxLcbzWxdjFwcQgI7GSW+vTnABOH8YpRY//oeC0gVm4ChRO/RPkYQW0RAW2LOzQ6wDmaB t4wSDWfagBwODmGBKInPy8FqWARUJd7s+MUMYvMKWEk8ONzMArFNXmL1hgPMExi5FjAyrGKU TC0ozk3PLTYqMMxLLdcrTswtLs1L10vOz93ECAyabYe1+nYw3l8Sf4hRgINRiYdXgyEnRog1 say4MvcQowQHs5IIryEXUIg3JbGyKrUoP76oNCe1+BCjNAeLkjjv7bxjkUIC6YklqdmpqQWp RTBZJg5OqQZGkdxHX3bXLnpZymFfF/Au/4L5mRkTw/41m+0UrPHlPbrm53lu1Yvhghf5v2+3 KW6/5lj01vHIIZk3D91YDXveJFY3qe8p9DsdYXP/l8evWdKqiU4WUav3HXBiOfeueNHjTTEf Jzp2PTr951ABx7L/KfeOfrdx8xAy9t1wKtTyu+G3szdtMtyslFiKMxINtZiLihMBoTT+JRYC AAA= X-CMS-MailID: 20190219152012epcas1p4df1d6e4f6439ab05de95c089a4416e06 CMS-TYPE: 101P X-CMS-RootMailID: 20190219152012epcas1p4df1d6e4f6439ab05de95c089a4416e06 References: Cc: alsa-devel@alsa-project.org, linux-samsung-soc@vger.kernel.org, b.zolnierkie@samsung.com, sbkim73@samsung.com, linux-kernel@vger.kernel.org, krzk@kernel.org, Sylwester Nawrocki , m.szyprowski@samsung.com Subject: [alsa-devel] [PATCH v2 1/2] ASoC: samsung: i2s: Fix secondary platform device unregistration 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 This fixes unregistration of the secondary platform device so all resources are properly released. Additionally the removal sequence is corrected so it is in reverse order comparing to probe sequence. The test against NULL priv->pdev_sec is removed as it is not necessary. Signed-off-by: Sylwester Nawrocki Acked-by: Krzysztof Kozlowski --- Changes since v1: - corrected order of calls on error path in probe() and in remove(). sound/soc/samsung/i2s.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) -- 2.17.1 diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 02472f576e17..cd92bb6e1da1 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -1359,11 +1359,10 @@ static int i2s_create_secondary_device(struct samsung_i2s_priv *priv) static void i2s_delete_secondary_device(struct samsung_i2s_priv *priv) { - if (priv->pdev_sec) { - platform_device_del(priv->pdev_sec); - priv->pdev_sec = NULL; - } + platform_device_unregister(priv->pdev_sec); + priv->pdev_sec = NULL; } + static int samsung_i2s_probe(struct platform_device *pdev) { struct i2s_dai *pri_dai, *sec_dai = NULL; @@ -1487,14 +1486,14 @@ static int samsung_i2s_probe(struct platform_device *pdev) sec_dai->filter, "tx-sec", NULL, &pdev->dev); if (ret < 0) - goto err_disable_clk; + goto err_del_sec; } if (i2s_pdata && i2s_pdata->cfg_gpio && i2s_pdata->cfg_gpio(pdev)) { dev_err(&pdev->dev, "Unable to configure gpio\n"); ret = -EINVAL; - goto err_disable_clk; + goto err_del_sec; } dev_set_drvdata(&pdev->dev, priv); @@ -1503,7 +1502,7 @@ static int samsung_i2s_probe(struct platform_device *pdev) &samsung_i2s_component, priv->dai_drv, num_dais); if (ret < 0) - goto err_disable_clk; + goto err_del_sec; pm_runtime_set_active(&pdev->dev); pm_runtime_enable(&pdev->dev); @@ -1518,9 +1517,10 @@ static int samsung_i2s_probe(struct platform_device *pdev) err_disable_pm: pm_runtime_disable(&pdev->dev); +err_del_sec: + i2s_delete_secondary_device(priv); err_disable_clk: clk_disable_unprepare(priv->clk); - i2s_delete_secondary_device(priv); return ret; } @@ -1536,9 +1536,10 @@ static int samsung_i2s_remove(struct platform_device *pdev) pm_runtime_disable(&pdev->dev); i2s_unregister_clock_provider(priv); + i2s_delete_secondary_device(priv); clk_disable_unprepare(priv->clk); + pm_runtime_put_noidle(&pdev->dev); - i2s_delete_secondary_device(priv); return 0; }