Skip to contentSkip to conversation

gpu: host1x: mipi: Fix device_node reference leak in tegra_mipi_request()

PATCH Applied Felix Gu 2 participants 2 messages Apr 16 – May 28

Subsystems (3)
lore
Share & tools
lore

Felix Gu

author
#0 lore raw

PATCH 1/1 gpu: host1x: mipi: Fix device_node reference leak in tegra_mipi_request()

In tegra_mipi_request(), when provider.np is not equal with args.np, it returns without calling of_node_put(args.np), causing a reference leak.

Convert to use the existing goto out pattern to ensure proper cleanup.

Fixes 767598d447aa ("gpu: host1x: mipi: Update tegra_mipi_request() to be node based")
---
 drivers/gpu/host1x/mipi.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/host1x/mipi.c +4 -2
index 01513b775d89..988681423981 100644
@@ -114,8 +114,10 @@ struct tegra_mipi_device *tegra_mipi_request(struct device *device,
 	if (err < 0)
 		return ERR_PTR(err);
 
-	if (provider.np != args.np)
-		return ERR_PTR(-ENODEV);
+	if (provider.np != args.np) {
+		err = -ENODEV;
+		goto out;
+	}
 
 	mipidev = kzalloc_obj(*mipidev);
 	if (!mipidev) {

---
base-commit: 936c21068d7ade00325e40d82bfd2f3f29d9f659
change-id: 20260416-mipi-8dfb3cc647e4

Best regards,

Signature · 1 line
Felix Gu <[email protected]>
maintainer Applied
#1 lore raw
Quoted 10 lines · Felix Gu

In tegra_mipi_request(), when provider.np is not equal with args.np, it returns without calling of_node_put(args.np), causing a reference leak.

Convert to use the existing goto out pattern to ensure proper cleanup.

Fixes 767598d447aa ("gpu: host1x: mipi: Update tegra_mipi_request() to be node based")
---
 drivers/gpu/host1x/mipi.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Applied, thanks.

Thierry