diff mbox series

[next] media: xilinx-tpg: fix double put in xtpg_parse_of()

Message ID f41dfe97-6e6c-47b4-91bf-199c5938c6d0@stanley.mountain (mailing list archive)
State New
Headers show
Series [next] media: xilinx-tpg: fix double put in xtpg_parse_of() | expand

Commit Message

Dan Carpenter Nov. 4, 2024, 5:16 p.m. UTC
This loop was recently converted to use for_each_of_graph_port() which
automatically does __cleanup__ on the "port" iterator variable.  Delete
the calls to of_node_put(port) to avoid a double put bug.

Fixes: 393194cdf11e ("media: xilinx-tpg: use new of_graph functions")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/media/platform/xilinx/xilinx-tpg.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Dan Carpenter Nov. 5, 2024, 4:45 p.m. UTC | #1
On Mon, Nov 04, 2024 at 08:16:19PM +0300, Dan Carpenter wrote:
> This loop was recently converted to use for_each_of_graph_port() which
> automatically does __cleanup__ on the "port" iterator variable.  Delete
> the calls to of_node_put(port) to avoid a double put bug.
> 
> Fixes: 393194cdf11e ("media: xilinx-tpg: use new of_graph functions")

I guess the CI system applies this to the wrong git tree so it says
the of_node_put() calls are necessary and it can't find the Fixes
commit.

regards,
dan carpenter
Laurent Pinchart Nov. 5, 2024, 4:59 p.m. UTC | #2
Hi Dan,

Thank you for the patch.

On Mon, Nov 04, 2024 at 08:16:19PM +0300, Dan Carpenter wrote:
> This loop was recently converted to use for_each_of_graph_port() which
> automatically does __cleanup__ on the "port" iterator variable.  Delete
> the calls to of_node_put(port) to avoid a double put bug.
> 
> Fixes: 393194cdf11e ("media: xilinx-tpg: use new of_graph functions")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

The offending commit wasn't merged through the media tree, so we can't
easily merge the fix there either. I'm fine merging this fix through
Rob's tree.

> ---
>  drivers/media/platform/xilinx/xilinx-tpg.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/media/platform/xilinx/xilinx-tpg.c b/drivers/media/platform/xilinx/xilinx-tpg.c
> index cb93711ea3e3..7deec6e37edc 100644
> --- a/drivers/media/platform/xilinx/xilinx-tpg.c
> +++ b/drivers/media/platform/xilinx/xilinx-tpg.c
> @@ -722,7 +722,6 @@ static int xtpg_parse_of(struct xtpg_device *xtpg)
>  		format = xvip_of_get_format(port);
>  		if (IS_ERR(format)) {
>  			dev_err(dev, "invalid format in DT");
> -			of_node_put(port);
>  			return PTR_ERR(format);
>  		}
>  
> @@ -731,7 +730,6 @@ static int xtpg_parse_of(struct xtpg_device *xtpg)
>  			xtpg->vip_format = format;
>  		} else if (xtpg->vip_format != format) {
>  			dev_err(dev, "in/out format mismatch in DT");
> -			of_node_put(port);
>  			return -EINVAL;
>  		}
>
diff mbox series

Patch

diff --git a/drivers/media/platform/xilinx/xilinx-tpg.c b/drivers/media/platform/xilinx/xilinx-tpg.c
index cb93711ea3e3..7deec6e37edc 100644
--- a/drivers/media/platform/xilinx/xilinx-tpg.c
+++ b/drivers/media/platform/xilinx/xilinx-tpg.c
@@ -722,7 +722,6 @@  static int xtpg_parse_of(struct xtpg_device *xtpg)
 		format = xvip_of_get_format(port);
 		if (IS_ERR(format)) {
 			dev_err(dev, "invalid format in DT");
-			of_node_put(port);
 			return PTR_ERR(format);
 		}
 
@@ -731,7 +730,6 @@  static int xtpg_parse_of(struct xtpg_device *xtpg)
 			xtpg->vip_format = format;
 		} else if (xtpg->vip_format != format) {
 			dev_err(dev, "in/out format mismatch in DT");
-			of_node_put(port);
 			return -EINVAL;
 		}