ata: sata_highbank: fix OF node reference leak in highbank_initialize_phys()
authorJoe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Thu, 5 Dec 2024 10:30:14 +0000 (19:30 +0900)
committerDamien Le Moal <dlemoal@kernel.org>
Mon, 9 Dec 2024 00:06:58 +0000 (09:06 +0900)
The OF node reference obtained by of_parse_phandle_with_args() is not
released on early return. Add a of_node_put() call before returning.

Fixes: 8996b89d6bc9 ("ata: add platform driver for Calxeda AHCI controller")
Signed-off-by: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
drivers/ata/sata_highbank.c

index b1b40e9551deda1b02f902ff065e64843559eea0..c8c817c51230a74df721016eb80238c188d96d01 100644 (file)
@@ -348,6 +348,7 @@ static int highbank_initialize_phys(struct device *dev, void __iomem *addr)
                        phy_nodes[phy] = phy_data.np;
                        cphy_base[phy] = of_iomap(phy_nodes[phy], 0);
                        if (cphy_base[phy] == NULL) {
+                               of_node_put(phy_data.np);
                                return 0;
                        }
                        phy_count += 1;