From patchwork Wed Feb 20 11:06:07 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: 10822151 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 7A4C56C2 for ; Wed, 20 Feb 2019 13:33:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 607B02E17E for ; Wed, 20 Feb 2019 13:33:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 53CD52E181; Wed, 20 Feb 2019 13:33:25 +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 autolearn=unavailable version=3.3.1 Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 682DD2E169 for ; Wed, 20 Feb 2019 13:33:24 +0000 (UTC) Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id CAB38F8077D; Wed, 20 Feb 2019 12:06:33 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz CAB38F8077D Authentication-Results: alsa1.perex.cz; dkim=fail reason="signature verification failed" (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="MLl2WFft" X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3D525F8077D; Wed, 20 Feb 2019 12:06:32 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 3D525F8077D Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 22FF2F80758 for ; Wed, 20 Feb 2019 12:06:26 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 22FF2F80758 Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20190220110622epoutp038fdc4067cb226619f16fd00c7c9d0d24~FDcP4pIJl3102431024epoutp03F; Wed, 20 Feb 2019 11:06:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20190220110622epoutp038fdc4067cb226619f16fd00c7c9d0d24~FDcP4pIJl3102431024epoutp03F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1550660782; bh=7xxjYN7BZ1rBwkZ2CY8yx070GqqxQakElrJeHeGId7Q=; h=From:To:Cc:Subject:Date:References:From; b=MLl2WFftBJyaRfwD4jEMj7H/QJbbs2bmJeMb8nIDoDn7GsWR2RAd8r5SEWMiYnSVS fA3Jp7KtTZxAWEzsLTiCdWMFamSmKLSslveSEC/e190hoGwDuwjwxtrh2YHKnHd5E2 +hVUpThRpp4OzO5qr0AtMYqrudv4O2FOYBcKq738= Received: from epsmges2p4.samsung.com (unknown [182.195.42.72]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20190220110621epcas2p48f759a8108135fe8690d4878743faaa5~FDcPoa79Y2139321393epcas2p4T; Wed, 20 Feb 2019 11:06:21 +0000 (GMT) Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id 92.D2.04093.DA43D6C5; Wed, 20 Feb 2019 20:06:21 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20190220110620epcas2p27841bf821d10beab780362bdd59d9020~FDcOmnAA62077520775epcas2p2i; Wed, 20 Feb 2019 11:06:20 +0000 (GMT) X-AuditID: b6c32a48-173ff70000000ffd-69-5c6d34ad726a Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id D9.5B.03689.CA43D6C5; Wed, 20 Feb 2019 20:06:20 +0900 (KST) Received: from AMDC3061.digital.local ([106.116.147.40]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PN800HCZ1I9ZH60@mmp2.samsung.com>; Wed, 20 Feb 2019 20:06:20 +0900 (KST) From: Sylwester Nawrocki To: broonie@kernel.org, lgirdwood@gmail.com Date: Wed, 20 Feb 2019 12:06:07 +0100 Message-id: <20190220110607.13293-1-s.nawrocki@samsung.com> X-Mailer: git-send-email 2.17.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrBIsWRmVeSWpSXmKPExsWy7bCmme5ak9wYg4+3NS2uXDzEZLFxxnpW i6kPn7BZnD+/gd3i25UOJovLu+awWcw4v4/JYu2Ru+wWh9+0s1pcXPGFyeLl5jdMDtweGz43 sXnsnHWX3WPTqk42j74tqxg9Np+u9vi8SS6ALYrLJiU1J7MstUjfLoErY9m0RUwF7wQq5v+Y z9TAeJ23i5GTQ0LARGLf9vesXYxcHEICOxglJh9eyAbhfGeUaHvXxAZTtf7pV6jEBkaJnmf9 jBDOL0aJCXf+sYJUsQkYSvQe7WMEsUUEtCXm3OwA62AW+MMo0X58PdgoYQE3iQ+NrWA2i4Cq xJfZL5lAbF4Ba4l7pzaxQKyTl1i94QAzSLOEwBQ2icYPfxkhEi4Sr1bdYYewpSWerdoIFa+W 2LW9G6qhg1Gi5cJ2ZoiEt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V858fPL5jshcxrm 75n/Snjm94v7/ZhTfdmcJztP3DDlbUH8LYOMo3kXZ/FltFu8+zflvOrh6opLSizFGYmGWsxF xYkAZ/fpHCACAAA= X-CMS-MailID: 20190220110620epcas2p27841bf821d10beab780362bdd59d9020 CMS-TYPE: 102P X-CMS-RootMailID: 20190220110620epcas2p27841bf821d10beab780362bdd59d9020 References: Cc: alsa-devel@alsa-project.org, linux-samsung-soc@vger.kernel.org, b.zolnierkie@samsung.com, tiwai@suse.de, linux-kernel@vger.kernel.org, krzk@kernel.org, sbkim73@samsung.com, Sylwester Nawrocki , m.szyprowski@samsung.com Subject: [alsa-devel] [PATCH] ASoC: samsung: odroid: Fix of_node refcount unbalance X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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" X-Virus-Scanned: ClamAV using ClamSMTP In odroid_audio_probe() some OF nodes are left without reference count decrease after use. Fix it by ensuring required of_node_calls() are done before exiting probe. Reported-by: Takashi Iwai Signed-off-by: Sylwester Nawrocki --- sound/soc/samsung/odroid.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/sound/soc/samsung/odroid.c b/sound/soc/samsung/odroid.c index bd2c5163dc7f..c3b0f6c612cb 100644 --- a/sound/soc/samsung/odroid.c +++ b/sound/soc/samsung/odroid.c @@ -257,27 +257,31 @@ static int odroid_audio_probe(struct platform_device *pdev) ret = of_parse_phandle_with_args(cpu, "sound-dai", "#sound-dai-cells", i, &args); if (ret < 0) - return ret; + break; if (!args.np) { dev_err(dev, "sound-dai property parse error: %d\n", ret); - return -EINVAL; + ret = -EINVAL; + break; } ret = snd_soc_get_dai_name(&args, &link->cpu_dai_name); of_node_put(args.np); if (ret < 0) - return ret; + break; } + if (ret == 0) + cpu_dai = of_parse_phandle(cpu, "sound-dai", 0); - cpu_dai = of_parse_phandle(cpu, "sound-dai", 0); of_node_put(cpu); of_node_put(codec); + if (ret < 0) + return ret; ret = snd_soc_of_get_dai_link_codecs(dev, codec, codec_link); if (ret < 0) - goto err_put_codec_n; + goto err_put_cpu_dai; /* Set capture capability only for boards with the MAX98090 CODEC */ if (codec_link->num_codecs > 1) { @@ -288,7 +292,7 @@ static int odroid_audio_probe(struct platform_device *pdev) priv->sclk_i2s = of_clk_get_by_name(cpu_dai, "i2s_opclk1"); if (IS_ERR(priv->sclk_i2s)) { ret = PTR_ERR(priv->sclk_i2s); - goto err_put_codec_n; + goto err_put_cpu_dai; } priv->clk_i2s_bus = of_clk_get_by_name(cpu_dai, "iis"); @@ -310,7 +314,8 @@ static int odroid_audio_probe(struct platform_device *pdev) clk_put(priv->clk_i2s_bus); err_put_sclk: clk_put(priv->sclk_i2s); -err_put_codec_n: +err_put_cpu_dai: + of_node_put(cpu_dai); snd_soc_of_put_dai_link_codecs(codec_link); return ret; }