From patchwork Wed Sep 18 10:46:33 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: 11150105 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C21D114E5 for ; Wed, 18 Sep 2019 10:47:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 95AA7214AF for ; Wed, 18 Sep 2019 10:47:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="cBLgTFIl" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727703AbfIRKrR (ORCPT ); Wed, 18 Sep 2019 06:47:17 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:56551 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725899AbfIRKrR (ORCPT ); Wed, 18 Sep 2019 06:47:17 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20190918104715euoutp01b7cc81d75fe9cb3f6ae752831d2f2d93~Fgpg3L34S1222412224euoutp016 for ; Wed, 18 Sep 2019 10:47:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20190918104715euoutp01b7cc81d75fe9cb3f6ae752831d2f2d93~Fgpg3L34S1222412224euoutp016 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1568803635; bh=xXzfRu9QLTj/XX7HXJ29mEGOJQBJL9qoYmNOwy+z2GM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cBLgTFIlp2xwag5s2nE+XyzqaG6yFfhIwpb5Bph19QJdlHCiBbcwazbIYs06UFuvN rdwIZf23QEEyEL+0d3VgMpGjVp0F5G4WphXgxDSMlsfr1zaytcctEQDuk6bnCNm+ZF FEfkg8IBSoFtui4z2Lx6UI9wHViVUWGPtmmG8jVI= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20190918104714eucas1p2b7218f8911155c2d56c4a1da5d80bf05~FgpgCUZJA2379323793eucas1p2q; Wed, 18 Sep 2019 10:47:14 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id FC.B4.04309.23B028D5; Wed, 18 Sep 2019 11:47:14 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20190918104713eucas1p2ccfa8e9dff2cda9e8f88ac42dda2b680~FgpfElMvl2378523785eucas1p2h; Wed, 18 Sep 2019 10:47:13 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20190918104713eusmtrp29acc9faf5d3931e383eca1b2ea862182~Fgpe0-fxX1585315853eusmtrp2S; Wed, 18 Sep 2019 10:47:13 +0000 (GMT) X-AuditID: cbfec7f4-ae1ff700000010d5-34-5d820b32dad1 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 84.C6.04166.13B028D5; Wed, 18 Sep 2019 11:47:13 +0100 (BST) Received: from AMDC3061.DIGITAL.local (unknown [106.120.51.75]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20190918104712eusmtip1eb199f3c78fc8fa94af113a38915a02c~FgpeNp1H10494604946eusmtip1E; Wed, 18 Sep 2019 10:47:12 +0000 (GMT) From: Sylwester Nawrocki To: broonie@kernel.org Cc: lgirdwood@gmail.com, ckeepax@opensource.cirrus.com, krzk@kernel.org, sbkim73@samsung.com, alsa-devel@alsa-project.org, robh+dt@kernel.org, devicetree@vger.kernel.org, patches@opensource.cirrus.com, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, b.zolnierkie@samsung.com, m.szyprowski@samsung.com, Sylwester Nawrocki Subject: [PATCH v1 8/9] ASoC: samsung: arndale: Add missing OF node dereferencing Date: Wed, 18 Sep 2019 12:46:33 +0200 Message-Id: <20190918104634.15216-9-s.nawrocki@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190918104634.15216-1-s.nawrocki@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0VSe0hTcRTud+/u7lWbXLfKgz2skUFBmfbgUtIDDFeECP0RGZIzL9Ny03bV sgiH5StNSxOXDdSMtJk6l2kqpk1zVuZcSSUiKmlvldSifObtKv73ne9xzvfHoXBpCeFGhWui Wa1GGSEXO4qqW//atno7JQRt7+x3ZrrsFoyp1FcQTM7AoJjpSjQjJr+lg2BsNhPJ/O5KwRjz x3cEo7c9xZiyll6SGR9tJJjEhhaSaf6RTDD2kgnsgLPCNJ4gVtTm9ZIKszFVrHh0L16Ra5hD iowqI1KMm9cFkIGOPqFsRHgsq/XcF+wYVlNmEEcVuVzIyjQQOtTgfA05UEDvhNfGL9g15EhJ 6RIEg8k3CWGYQDBdmbQwjCP4UX1FvBjpK5wkBaEYgf3r56XIs7c1OO8S015w/XkG4vEKehX0 GFJx3oTT0xgMz+SJeEFGH4ORHtO8iaJEtAe06mQ8LaH3QnnpH1K45g6lpqb/Ox1oHxjr7Bfx e4CuI6E4e2Chki8MZbVjApbBN2vVQngNzNXmY0LgCoL0+h5SGG4g6LMWIMG1F5qtdoJvgdOb oaLOU6APQuXV2yRPA+0MH4ZdeBqfh1nVubhASyAlSSq4N8KUMXehghukDc6JBKyA9Lt3/mMp nYlgNDvwBnLPW7pVgJARubIxnFrFct4a9vw2TqnmYjSqbacj1WY0/z+vZq0TT1DddIgF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R+ue9M1oTsvjOqN9wnpz 4f/Gwy8382+Y/OlC6Io2Hcm42G++W+7Yi/kdVpAzmrjBx5fP/bHIk+P/t35cHDgljO/HHosD VyKVWIozEg21mIuKEwEA8vqfmwIAAA== X-CMS-MailID: 20190918104713eucas1p2ccfa8e9dff2cda9e8f88ac42dda2b680 X-Msg-Generator: CA X-RootMTR: 20190918104713eucas1p2ccfa8e9dff2cda9e8f88ac42dda2b680 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20190918104713eucas1p2ccfa8e9dff2cda9e8f88ac42dda2b680 References: <20190918104634.15216-1-s.nawrocki@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Ensure there is no OF node references kept when the driver is removed/unbound. Signed-off-by: Sylwester Nawrocki Reviewed-by: Charles Keepax --- sound/soc/samsung/arndale_rt5631.c | 31 ++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/sound/soc/samsung/arndale_rt5631.c b/sound/soc/samsung/arndale_rt5631.c index 3744c47742b8..d8da313e898a 100644 --- a/sound/soc/samsung/arndale_rt5631.c +++ b/sound/soc/samsung/arndale_rt5631.c @@ -132,6 +132,17 @@ static struct snd_soc_card arndale_wm1811 = { .num_links = ARRAY_SIZE(arndale_wm1811_dai), }; +static void arndale_put_of_nodes(struct snd_soc_card *card) +{ + struct snd_soc_dai_link *dai_link; + int i; + + for_each_card_prelinks(card, i, dai_link) { + of_node_put(dai_link->cpus->of_node); + of_node_put(dai_link->codecs->of_node); + } +} + static int arndale_audio_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; @@ -156,16 +167,31 @@ static int arndale_audio_probe(struct platform_device *pdev) if (!dai_link->codecs->of_node) { dev_err(&pdev->dev, "Property 'samsung,audio-codec' missing or invalid\n"); - return -EINVAL; + ret = -EINVAL; + goto err_put_of_nodes; } ret = devm_snd_soc_register_card(card->dev, card); - if (ret) + if (ret) { dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); + goto err_put_of_nodes; + } + return 0; + +err_put_of_nodes: + arndale_put_of_nodes(card); return ret; } +static int arndale_audio_remove(struct platform_device *pdev) +{ + struct snd_soc_card *card = platform_get_drvdata(pdev); + + arndale_put_of_nodes(card); + return 0; +} + static const struct of_device_id arndale_audio_of_match[] __maybe_unused = { { .compatible = "samsung,arndale-rt5631", .data = &arndale_rt5631 }, { .compatible = "samsung,arndale-alc5631", .data = &arndale_rt5631 }, @@ -181,6 +207,7 @@ static struct platform_driver arndale_audio_driver = { .of_match_table = arndale_audio_of_match, }, .probe = arndale_audio_probe, + .remove = arndale_audio_remove, }; module_platform_driver(arndale_audio_driver);