[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220630014153.1888811-1-yangyingliang@huawei.com>
Date: Thu, 30 Jun 2022 09:41:53 +0800
From: Yang Yingliang <yangyingliang@...wei.com>
To: <linux-kernel@...r.kernel.org>, <netdev@...r.kernel.org>,
<linux-renesas-soc@...r.kernel.org>
CC: <clement.leger@...tlin.com>, <olteanv@...il.com>,
<f.fainelli@...il.com>, <davem@...emloft.net>
Subject: [PATCH -next v2] net: dsa: rzn1-a5psw: add missing of_node_put() in a5psw_pcs_get()
of_parse_phandle() will increase the refcount of 'pcs_node', so add
of_node_put() before return from a5psw_pcs_get().
Fixes: 888cdb892b61 ("net: dsa: rzn1-a5psw: add Renesas RZ/N1 advanced 5 port switch driver")
Reported-by: Hulk Robot <hulkci@...wei.com>
Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
---
v2:
call of_node_put() after miic_create()
---
drivers/net/dsa/rzn1_a5psw.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
index 3e910da98ae2..dece613ee881 100644
--- a/drivers/net/dsa/rzn1_a5psw.c
+++ b/drivers/net/dsa/rzn1_a5psw.c
@@ -917,12 +917,14 @@ static int a5psw_pcs_get(struct a5psw *a5psw)
}
a5psw->pcs[reg] = pcs;
+ of_node_put(pcs_node);
}
of_node_put(ports);
return 0;
free_pcs:
+ of_node_put(pcs_node);
of_node_put(port);
of_node_put(ports);
a5psw_pcs_free(a5psw);
--
2.25.1
Powered by blists - more mailing lists