mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: wangkailong@jari.cn
To: mchehab@kernel.org, matthias.bgg@gmail.com,
	hverkuil-cisco@xs4all.nl, moudy.ho@mediatek.com,
	sunke32@huawei.com
Cc: linux-media@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: [PATCH] media: platform: mtk-mdp3: add missing call to of_node_put()
Date: Sun, 13 Nov 2022 19:05:16 +0800 (GMT+08:00)	[thread overview]
Message-ID: <be6c204.133.18470aa3e15.Coremail.wangkailong@jari.cn> (raw)

Fix the following coccicheck warning:

drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c:892:1-23: WARNING:
Function "for_each_child_of_node" should have of_node_put() before
return around line 914.
drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c:892:1-23: WARNING:
Function "for_each_child_of_node" should have of_node_put() before
return around line 920.
drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c:951:1-23: WARNING:
Function "for_each_child_of_node" should have of_node_put() before
return around line 993.

Signed-off-by: KaiLong Wang <wangkailong@jari.cn>
---
 drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c
index d3eaf8884412..4162fc732f38 100644
--- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c
+++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c
@@ -908,6 +908,7 @@ static int mdp_comp_sub_create(struct mdp_dev *mdp)
 		alias_id = mdp_comp_alias_id[type];
 		id = mdp_comp_get_id(type, alias_id);
 		if (id < 0) {
+			of_node_put(node);
 			dev_err(dev,
 				"Fail to get sub comp. id: type %d alias %d\n",
 				type, alias_id);
@@ -916,8 +917,10 @@ static int mdp_comp_sub_create(struct mdp_dev *mdp)
 		mdp_comp_alias_id[type]++;
 
 		comp = mdp_comp_create(mdp, node, id);
-		if (IS_ERR(comp))
+		if (IS_ERR(comp)) {
+			of_node_put(node);
 			return PTR_ERR(comp);
+		}
 	}
 
 	return 0;
@@ -988,6 +991,7 @@ int mdp_comp_config(struct mdp_dev *mdp)
 
 		pdev = of_find_device_by_node(node);
 		if (!pdev) {
+			of_node_put(node);
 			dev_warn(dev, "can't find platform device of node:%s\n",
 				 node->name);
 			return -ENODEV;
-- 
2.25.1

             reply	other threads:[~2022-11-13 11:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-13 11:05 wangkailong [this message]
2022-11-18 14:43 ` Hans Verkuil

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=be6c204.133.18470aa3e15.Coremail.wangkailong@jari.cn \
    --to=wangkailong@jari.cn \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mchehab@kernel.org \
    --cc=moudy.ho@mediatek.com \
    --cc=sunke32@huawei.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®