All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lijun Fang <fanglijun3@huawei.com>
To: <linux-media@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: <ming.qian@nxp.com>, <shijie.qin@nxp.com>, <eagle.zhou@nxp.com>,
	<mchehab@kernel.org>, <hverkuil-cisco@xs4all.nl>,
	<xuqiang36@huawei.com>
Subject: [PATCH] media: amphion: Add missing of_node_put() in vpu_core_parse_dt
Date: Mon, 14 Mar 2022 06:09:52 +0000	[thread overview]
Message-ID: <20220314060952.66762-1-fanglijun3@huawei.com> (raw)

The device_node pointer is returned by of_parse_phandle()  with refcount
incremented. We should use of_node_put() on it when done.

Fixes: 9f599f351e86 ("media: amphion: add vpu core driver")
Signed-off-by: Lijun Fang <fanglijun3@huawei.com>
---
 drivers/media/platform/amphion/vpu_core.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/media/platform/amphion/vpu_core.c b/drivers/media/platform/amphion/vpu_core.c
index 016554387f3f..74edc4abbdaa 100644
--- a/drivers/media/platform/amphion/vpu_core.c
+++ b/drivers/media/platform/amphion/vpu_core.c
@@ -529,10 +529,12 @@ static int vpu_core_parse_dt(struct vpu_core *core, struct device_node *np)
 	}
 	if (of_address_to_resource(node, 0, &res)) {
 		dev_err(core->dev, "boot-region of_address_to_resource error\n");
+		of_node_put(node);
 		return -EINVAL;
 	}
 	core->fw.phys = res.start;
 	core->fw.length = resource_size(&res);
+	of_node_put(node);
 
 	node = of_parse_phandle(np, "memory-region", 1);
 	if (!node) {
@@ -541,10 +543,12 @@ static int vpu_core_parse_dt(struct vpu_core *core, struct device_node *np)
 	}
 	if (of_address_to_resource(node, 0, &res)) {
 		dev_err(core->dev, "rpc-region of_address_to_resource error\n");
+		of_node_put(node);
 		return -EINVAL;
 	}
 	core->rpc.phys = res.start;
 	core->rpc.length = resource_size(&res);
+	of_node_put(node);
 
 	if (core->rpc.length < core->res->rpc_size + core->res->fwlog_size) {
 		dev_err(core->dev, "the rpc-region <%pad, 0x%x> is not enough\n",
-- 
2.17.1


             reply	other threads:[~2022-03-14  6:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-14  6:09 Lijun Fang [this message]
2022-03-14  7:22 ` [PATCH] media: amphion: Add missing of_node_put() in vpu_core_parse_dt Ming Qian

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=20220314060952.66762-1-fanglijun3@huawei.com \
    --to=fanglijun3@huawei.com \
    --cc=eagle.zhou@nxp.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=ming.qian@nxp.com \
    --cc=shijie.qin@nxp.com \
    --cc=xuqiang36@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.