]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
media: nuvoton: Fix reference handling of ece_node
authorRicardo Ribalda <ribalda@chromium.org>
Mon, 24 Feb 2025 07:03:54 +0000 (07:03 +0000)
committerHans Verkuil <hverkuil@xs4all.nl>
Tue, 25 Feb 2025 08:14:05 +0000 (09:14 +0100)
Make sure all the code paths call of_node_put().

Instead of manually calling of_node_put, use the __free macros/helpers.

Cc: stable@vger.kernel.org
Fixes: 46c15a4ff1f4 ("media: nuvoton: Add driver for NPCM video capture and encoding engine")
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
drivers/media/platform/nuvoton/npcm-video.c

index 024cd8ee17098d62512175c416a1e0cc932c1910..0547f119c38f0de664f77de585d28d07c68cdd8b 100644 (file)
@@ -1648,8 +1648,8 @@ rel_ctrl_handler:
 
 static int npcm_video_ece_init(struct npcm_video *video)
 {
+       struct device_node *ece_node __free(device_node) = NULL;
        struct device *dev = video->dev;
-       struct device_node *ece_node;
        struct platform_device *ece_pdev;
        void __iomem *regs;
 
@@ -1669,7 +1669,6 @@ static int npcm_video_ece_init(struct npcm_video *video)
                        dev_err(dev, "Failed to find ECE device\n");
                        return -ENODEV;
                }
-               of_node_put(ece_node);
 
                regs = devm_platform_ioremap_resource(ece_pdev, 0);
                if (IS_ERR(regs)) {