Skip to content

Commit

Permalink
media: c8sectpfe: Call of_node_put(i2c_bus) only once in c8sectpfe_pr…
Browse files Browse the repository at this point in the history
…obe()

[ Upstream commit b773530 ]

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>
  • Loading branch information
Markus Elfring authored and Greg Kroah-Hartman committed Jun 4, 2025
1 parent 74eea50 commit d5f8c8e
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -806,13 +806,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,
Expand Down

0 comments on commit d5f8c8e

Please sign in to comment.