From: Krzysztof Kozlowski <krzk@kernel.org>
To: Sylwester Nawrocki <s.nawrocki@samsung.com>
Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org,
linux-samsung-soc@vger.kernel.org, ckeepax@opensource.cirrus.com,
b.zolnierkie@samsung.com, sbkim73@samsung.com,
patches@opensource.cirrus.com, lgirdwood@gmail.com,
robh+dt@kernel.org, broonie@kernel.org,
linux-arm-kernel@lists.infradead.org, m.szyprowski@samsung.com
Subject: Re: [PATCH v1 8/9] ASoC: samsung: arndale: Add missing OF node dereferencing
Date: Thu, 19 Sep 2019 10:22:11 +0200 [thread overview]
Message-ID: <20190919082211.GF13195@pi3> (raw)
In-Reply-To: <20190918104634.15216-9-s.nawrocki@samsung.com>
On Wed, Sep 18, 2019 at 12:46:33PM +0200, Sylwester Nawrocki wrote:
> Ensure there is no OF node references kept when the driver is removed/unbound.
>
> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> ---
> sound/soc/samsung/arndale_rt5631.c | 31 ++++++++++++++++++++++++++++--
> 1 file changed, 29 insertions(+), 2 deletions(-)
Wasn't this issue introduced in 5/9? It looks weird to fix it here...
Best regards,
Krzysztof
>
> 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);
> --
> 2.17.1
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-09-19 8:22 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20190918104650eucas1p2288b0b7e8081e872c4f181cb5ca8ba0d@eucas1p2.samsung.com>
2019-09-18 10:46 ` [PATCH v1 0/9] Basic sound support for Arndale board / wm8994 updates Sylwester Nawrocki
2019-09-18 10:46 ` [PATCH v1 1/9] ASoC: wm8994: Do not register inapplicable controls for WM1811 Sylwester Nawrocki
2019-09-18 12:51 ` Charles Keepax
2019-09-19 7:38 ` Krzysztof Kozlowski
2019-09-18 10:46 ` [PATCH v1 2/9] mfd: wm8994: Add support for MCLKn clock control Sylwester Nawrocki
2019-09-18 10:59 ` Sylwester Nawrocki
2019-09-18 12:54 ` Charles Keepax
2019-09-18 13:36 ` Sylwester Nawrocki
2019-09-19 7:59 ` Krzysztof Kozlowski
2019-09-19 12:48 ` Sylwester Nawrocki
2019-09-19 13:07 ` Krzysztof Kozlowski
2019-09-19 12:50 ` Mark Brown
2019-09-19 14:31 ` Charles Keepax
2019-09-19 14:33 ` Mark Brown
2019-09-18 10:46 ` [PATCH v1 3/9] ASoC: wm8994: Add support for setting MCLKn clock rate Sylwester Nawrocki
2019-09-18 13:51 ` Charles Keepax
2019-09-19 8:00 ` Krzysztof Kozlowski
2019-09-18 10:46 ` [PATCH v1 4/9] ASoC: wm8994: Add support for MCLKn clock gating Sylwester Nawrocki
2019-09-18 14:31 ` Charles Keepax
2019-09-19 11:58 ` Sylwester Nawrocki
2019-09-19 14:33 ` Charles Keepax
2019-09-18 10:46 ` [PATCH v1 5/9] ASoC: samsung: arndale: Simplify DAI link initialization Sylwester Nawrocki
2019-09-18 14:33 ` Charles Keepax
2019-09-19 8:01 ` Krzysztof Kozlowski
2019-09-18 10:46 ` [PATCH v1 6/9] ASoC: dt-bindings: Document "samsung,arndale-wm1811" compatible Sylwester Nawrocki
2019-09-19 8:02 ` Krzysztof Kozlowski
2019-09-18 10:46 ` [PATCH v1 7/9] ASoC: samsung: arndale: Add support for WM1811 CODEC Sylwester Nawrocki
2019-09-18 14:45 ` Charles Keepax
2019-09-19 12:00 ` Sylwester Nawrocki
2019-09-18 10:46 ` [PATCH v1 8/9] ASoC: samsung: arndale: Add missing OF node dereferencing Sylwester Nawrocki
2019-09-18 14:51 ` Charles Keepax
2019-09-19 8:22 ` Krzysztof Kozlowski [this message]
2019-09-19 12:49 ` Sylwester Nawrocki
2019-09-19 12:58 ` Krzysztof Kozlowski
2019-09-19 13:31 ` [alsa-devel] " Sylwester Nawrocki
2019-09-18 10:46 ` [PATCH v1 9/9] ARM: dts: arndale: Add audio support (WM1811 CODEC boards) Sylwester Nawrocki
2019-09-19 8:26 ` Krzysztof Kozlowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190919082211.GF13195@pi3 \
--to=krzk@kernel.org \
--cc=alsa-devel@alsa-project.org \
--cc=b.zolnierkie@samsung.com \
--cc=broonie@kernel.org \
--cc=ckeepax@opensource.cirrus.com \
--cc=devicetree@vger.kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=patches@opensource.cirrus.com \
--cc=robh+dt@kernel.org \
--cc=s.nawrocki@samsung.com \
--cc=sbkim73@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).