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: 888cdb892b ("net: dsa: rzn1-a5psw: add Renesas RZ/N1 advanced 5 port switch driver")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20220630014153.1888811-1-yangyingliang@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Yang Yingliang 2022-06-30 09:41:53 +08:00 committed by Jakub Kicinski
parent 34eff17ec4
commit 5a24389457
1 changed files with 2 additions and 0 deletions

View File

@ -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);