]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
media: c8sectpfe: Call of_node_put(i2c_bus) only once in c8sectpfe_probe()
authorMarkus Elfring <elfring@users.sourceforge.net>
Fri, 4 Oct 2024 13:50:15 +0000 (15:50 +0200)
committerHans Verkuil <hverkuil@xs4all.nl>
Thu, 6 Mar 2025 16:28:28 +0000 (17:28 +0100)
An of_node_put(i2c_bus) call was immediately used after a pointer check
for an of_find_i2c_adapter_by_node() call in this function implementation.
Thus call such a function only once instead directly before the check.

This issue was transformed by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c

index 7b3a37957e3ae88fbd4c63604b352371a0fb7951..d151d2ed1f64bc28a66b72621c44ab2cc0f64c6d 100644 (file)
@@ -797,13 +797,12 @@ static int c8sectpfe_probe(struct platform_device *pdev)
                }
                tsin->i2c_adapter =
                        of_find_i2c_adapter_by_node(i2c_bus);
+               of_node_put(i2c_bus);
                if (!tsin->i2c_adapter) {
                        dev_err(&pdev->dev, "No i2c adapter found\n");
-                       of_node_put(i2c_bus);
                        ret = -ENODEV;
                        goto err_node_put;
                }
-               of_node_put(i2c_bus);
 
                /* Acquire reset GPIO and activate it */
                tsin->rst_gpio = devm_fwnode_gpiod_get(dev,