]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 4 Jun 2025 12:37:01 +0000 (14:37 +0200)
[ Upstream commit b773530a34df0687020520015057075f8b7b4ac4 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c

index b7e0ec265b70cf8ac2a86cad808bb966220e6b40..6e3b3643a2cdb057795fbee1f2422f16eda87683 100644 (file)
@@ -811,13 +811,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_clk_disable;
                }
-               of_node_put(i2c_bus);
 
                tsin->rst_gpio = of_get_named_gpio(child, "reset-gpios", 0);