From: Trevor Wu <trevor.wu@mediatek.com>
To: <broonie@kernel.org>, <tiwai@suse.com>, <matthias.bgg@gmail.com>
Cc: <trevor.wu@mediatek.com>, <alsa-devel@alsa-project.org>,
<linux-mediatek@lists.infradead.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <cuibixuan@huawei.com>,
<bicycle.tsai@mediatek.com>
Subject: [PATCH] ASoC: mediatek: mt8195: add missing of_node_put in probe
Date: Tue, 28 Sep 2021 14:35:20 +0800 [thread overview]
Message-ID: <20210928063520.23927-1-trevor.wu@mediatek.com> (raw)
dp node and hdmi node are retrieved from of_parse_phandle(), so using
of_node_put() on them before return.
Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
---
.../mt8195/mt8195-mt6359-rt1019-rt5682.c | 25 +++++++++++--------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c b/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c
index a3fa8efc8f81..cb15467e5fc5 100644
--- a/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c
+++ b/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c
@@ -995,6 +995,8 @@ static int mt8195_mt6359_rt1019_rt5682_dev_probe(struct platform_device *pdev)
{
struct snd_soc_card *card = &mt8195_mt6359_rt1019_rt5682_soc_card;
struct device_node *platform_node;
+ struct device_node *dp_node;
+ struct device_node *hdmi_node;
struct snd_soc_dai_link *dai_link;
struct mt8195_mt6359_rt1019_rt5682_priv *priv = NULL;
int ret, i;
@@ -1013,12 +1015,12 @@ static int mt8195_mt6359_rt1019_rt5682_dev_probe(struct platform_device *pdev)
dai_link->platforms->of_node = platform_node;
if (strcmp(dai_link->name, "DPTX_BE") == 0) {
- dai_link->codecs->of_node =
- of_parse_phandle(pdev->dev.of_node,
- "mediatek,dptx-codec", 0);
- if (!dai_link->codecs->of_node) {
+ dp_node = of_parse_phandle(pdev->dev.of_node,
+ "mediatek,dptx-codec", 0);
+ if (!dp_node) {
dev_dbg(&pdev->dev, "No property 'dptx-codec'\n");
} else {
+ dai_link->codecs->of_node = dp_node;
dai_link->codecs->name = NULL;
dai_link->codecs->dai_name = "i2s-hifi";
dai_link->init = mt8195_dptx_codec_init;
@@ -1026,12 +1028,12 @@ static int mt8195_mt6359_rt1019_rt5682_dev_probe(struct platform_device *pdev)
}
if (strcmp(dai_link->name, "ETDM3_OUT_BE") == 0) {
- dai_link->codecs->of_node =
- of_parse_phandle(pdev->dev.of_node,
- "mediatek,hdmi-codec", 0);
- if (!dai_link->codecs->of_node) {
+ hdmi_node = of_parse_phandle(pdev->dev.of_node,
+ "mediatek,hdmi-codec", 0);
+ if (!hdmi_node) {
dev_dbg(&pdev->dev, "No property 'hdmi-codec'\n");
} else {
+ dai_link->codecs->of_node = hdmi_node;
dai_link->codecs->name = NULL;
dai_link->codecs->dai_name = "i2s-hifi";
dai_link->init = mt8195_hdmi_codec_init;
@@ -1041,8 +1043,8 @@ static int mt8195_mt6359_rt1019_rt5682_dev_probe(struct platform_device *pdev)
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
if (!priv) {
- of_node_put(platform_node);
- return -ENOMEM;
+ ret = -ENOMEM;
+ goto out;
}
snd_soc_card_set_drvdata(card, priv);
@@ -1052,6 +1054,9 @@ static int mt8195_mt6359_rt1019_rt5682_dev_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n",
__func__, ret);
+out:
+ of_node_put(hdmi_node);
+ of_node_put(dp_node);
of_node_put(platform_node);
return ret;
}
--
2.18.0
next reply other threads:[~2021-09-28 6:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-28 6:35 Trevor Wu [this message]
2021-09-28 16:23 ` Mark Brown
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=20210928063520.23927-1-trevor.wu@mediatek.com \
--to=trevor.wu@mediatek.com \
--cc=alsa-devel@alsa-project.org \
--cc=bicycle.tsai@mediatek.com \
--cc=broonie@kernel.org \
--cc=cuibixuan@huawei.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=tiwai@suse.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
all inboxes | Powered by JetHome®