* [PATCH] media: platform: mtk-mdp3: add missing call to of_node_put()
@ 2022-11-13 11:05 wangkailong
2022-11-18 14:43 ` Hans Verkuil
0 siblings, 1 reply; 2+ messages in thread
From: wangkailong @ 2022-11-13 11:05 UTC (permalink / raw)
To: mchehab, matthias.bgg, hverkuil-cisco, moudy.ho, sunke32
Cc: linux-media, linux-arm-kernel, linux-mediatek, linux-kernel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] media: platform: mtk-mdp3: add missing call to of_node_put()
2022-11-13 11:05 [PATCH] media: platform: mtk-mdp3: add missing call to of_node_put() wangkailong
@ 2022-11-18 14:43 ` Hans Verkuil
0 siblings, 0 replies; 2+ messages in thread
From: Hans Verkuil @ 2022-11-18 14:43 UTC (permalink / raw)
To: wangkailong, mchehab, matthias.bgg, moudy.ho, sunke32
Cc: linux-media, linux-arm-kernel, linux-mediatek, linux-kernel
On 11/13/22 12:05, wangkailong@jari.cn wrote:
> 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;
There is a 'goto err_init_comps;' in this function as well that needs
an of_node_put(node); line.
Can you make a v2?
Regards,
Hans
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-18 14:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-13 11:05 [PATCH] media: platform: mtk-mdp3: add missing call to of_node_put() wangkailong
2022-11-18 14:43 ` Hans Verkuil
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®