]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: dsa: rzn1-a5psw: add missing of_node_put() in a5psw_pcs_get()
authorYang Yingliang <yangyingliang@huawei.com>
Thu, 30 Jun 2022 01:41:53 +0000 (09:41 +0800)
committerJakub Kicinski <kuba@kernel.org>
Fri, 1 Jul 2022 04:07:03 +0000 (21:07 -0700)
of_parse_phandle() will increase the refcount of 'pcs_node', so add
of_node_put() before return from a5psw_pcs_get().

Fixes: 82752fa04815 ("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>
drivers/net/dsa/rzn1_a5psw.c

index 5b14e2ba9b79a961ba78cc5d2fad32fafa79cdfd..0744e8162e1d593274dde6dfc150bce28e3e4e6a 100644 (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);