* [PATCH] media: amphion: Add missing of_node_put() in vpu_core_parse_dt
@ 2022-03-14 6:09 Lijun Fang
2022-03-14 7:22 ` Ming Qian
0 siblings, 1 reply; 2+ messages in thread
From: Lijun Fang @ 2022-03-14 6:09 UTC (permalink / raw)
To: linux-media, linux-kernel
Cc: ming.qian, shijie.qin, eagle.zhou, mchehab, hverkuil-cisco, xuqiang36
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: [PATCH] media: amphion: Add missing of_node_put() in vpu_core_parse_dt
2022-03-14 6:09 [PATCH] media: amphion: Add missing of_node_put() in vpu_core_parse_dt Lijun Fang
@ 2022-03-14 7:22 ` Ming Qian
0 siblings, 0 replies; 2+ messages in thread
From: Ming Qian @ 2022-03-14 7:22 UTC (permalink / raw)
To: Lijun Fang, linux-media, linux-kernel
Cc: Shijie Qin, Eagle Zhou, mchehab, hverkuil-cisco, xuqiang36
> From: Lijun Fang [mailto:fanglijun3@huawei.com]
> Sent: Monday, March 14, 2022 2:10 PM
> To: linux-media@vger.kernel.org; linux-kernel@vger.kernel.org
> Cc: Ming Qian <ming.qian@nxp.com>; Shijie Qin <shijie.qin@nxp.com>; Eagle
> Zhou <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
>
> 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>
Reviewed-by: Ming Qian <ming.qian@nxp.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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-03-14 7:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-14 6:09 [PATCH] media: amphion: Add missing of_node_put() in vpu_core_parse_dt Lijun Fang
2022-03-14 7:22 ` Ming Qian
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.