]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
gpu: host1x: mipi: Fix device_node reference leak in tegra_mipi_request()
authorFelix Gu <ustc.gu@gmail.com>
Thu, 16 Apr 2026 12:09:29 +0000 (20:09 +0800)
committerThierry Reding <treding@nvidia.com>
Thu, 28 May 2026 15:19:29 +0000 (17:19 +0200)
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")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patch.msgid.link/20260416-mipi-v1-1-9c027175abdf@gmail.com
drivers/gpu/host1x/mipi.c

index 01513b775d8996d7548bdae3cd82f883be60ef24..988681423981723718bc8833b6a372c8c2f2ee99 100644 (file)
@@ -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) {