[PATCH net-next RESEND 2/3] net: hisilicon: hns_dsaf_mac: fix OF node leak in hns_mac_get_info()

Krzysztof Kozlowski posted 3 patches 1 year, 3 months ago
[PATCH net-next RESEND 2/3] net: hisilicon: hns_dsaf_mac: fix OF node leak in hns_mac_get_info()
Posted by Krzysztof Kozlowski 1 year, 3 months ago
Driver is leaking OF node reference from
of_parse_phandle_with_fixed_args() in hns_mac_get_info().

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
index f75668c47935..616a2768e504 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
@@ -933,6 +933,7 @@ static int hns_mac_get_info(struct hns_mac_cb *mac_cb)
 			mac_cb->cpld_ctrl = NULL;
 		} else {
 			syscon = syscon_node_to_regmap(cpld_args.np);
+			of_node_put(cpld_args.np);
 			if (IS_ERR_OR_NULL(syscon)) {
 				dev_dbg(mac_cb->dev, "no cpld-syscon found!\n");
 				mac_cb->cpld_ctrl = NULL;
-- 
2.43.0
Re: [PATCH net-next RESEND 2/3] net: hisilicon: hns_dsaf_mac: fix OF node leak in hns_mac_get_info()
Posted by Simon Horman 1 year, 3 months ago
On Tue, Aug 27, 2024 at 04:44:20PM +0200, Krzysztof Kozlowski wrote:
> Driver is leaking OF node reference from
> of_parse_phandle_with_fixed_args() in hns_mac_get_info().
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Reviewed-by: Simon Horman <horms@kernel.org>