net: ethernet: mediatek: add missing of_node_put() in mtk_sgmii_init()
authorYang Yingliang <yangyingliang@huawei.com>
Thu, 28 Apr 2022 06:25:43 +0000 (14:25 +0800)
committerJakub Kicinski <kuba@kernel.org>
Sat, 30 Apr 2022 00:57:12 +0000 (17:57 -0700)
The node pointer returned by of_parse_phandle() with refcount incremented,
so add of_node_put() after using it in mtk_sgmii_init().

Fixes: 9ffee4a8276c ("net: ethernet: mediatek: Extend SGMII related functions")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20220428062543.64883-1-yangyingliang@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mediatek/mtk_sgmii.c

index 32d83421226a2c9c81d9d93269e5f2c4c5653552..5897940a418b6f4f1eb7e3519e66acf4a97e69a3 100644 (file)
@@ -26,6 +26,7 @@ int mtk_sgmii_init(struct mtk_sgmii *ss, struct device_node *r, u32 ana_rgc3)
                        break;
 
                ss->regmap[i] = syscon_node_to_regmap(np);
+               of_node_put(np);
                if (IS_ERR(ss->regmap[i]))
                        return PTR_ERR(ss->regmap[i]);
        }