Commit f32eb9d8 authored by Wen Yang's avatar Wen Yang Committed by David S. Miller

net: dsa: rtl8366rb: add missing of_node_put after calling of_get_child_by_name

of_node_put needs to be called when the device node which is got
from of_get_child_by_name finished using.
irq_domain_add_linear() also calls of_node_get() to increase refcount,
so irq_domain will not be affected when it is released.

Fixes: d8652956 ("net: dsa: realtek-smi: Add Realtek SMI driver")
Signed-off-by: default avatarWen Yang <wenyang@linux.alibaba.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Vivien Didelot <vivien.didelot@gmail.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d2c50b1c
...@@ -507,7 +507,8 @@ static int rtl8366rb_setup_cascaded_irq(struct realtek_smi *smi) ...@@ -507,7 +507,8 @@ static int rtl8366rb_setup_cascaded_irq(struct realtek_smi *smi)
irq = of_irq_get(intc, 0); irq = of_irq_get(intc, 0);
if (irq <= 0) { if (irq <= 0) {
dev_err(smi->dev, "failed to get parent IRQ\n"); dev_err(smi->dev, "failed to get parent IRQ\n");
return irq ? irq : -EINVAL; ret = irq ? irq : -EINVAL;
goto out_put_node;
} }
/* This clears the IRQ status register */ /* This clears the IRQ status register */
...@@ -515,7 +516,7 @@ static int rtl8366rb_setup_cascaded_irq(struct realtek_smi *smi) ...@@ -515,7 +516,7 @@ static int rtl8366rb_setup_cascaded_irq(struct realtek_smi *smi)
&val); &val);
if (ret) { if (ret) {
dev_err(smi->dev, "can't read interrupt status\n"); dev_err(smi->dev, "can't read interrupt status\n");
return ret; goto out_put_node;
} }
/* Fetch IRQ edge information from the descriptor */ /* Fetch IRQ edge information from the descriptor */
...@@ -537,7 +538,7 @@ static int rtl8366rb_setup_cascaded_irq(struct realtek_smi *smi) ...@@ -537,7 +538,7 @@ static int rtl8366rb_setup_cascaded_irq(struct realtek_smi *smi)
val); val);
if (ret) { if (ret) {
dev_err(smi->dev, "could not configure IRQ polarity\n"); dev_err(smi->dev, "could not configure IRQ polarity\n");
return ret; goto out_put_node;
} }
ret = devm_request_threaded_irq(smi->dev, irq, NULL, ret = devm_request_threaded_irq(smi->dev, irq, NULL,
...@@ -545,7 +546,7 @@ static int rtl8366rb_setup_cascaded_irq(struct realtek_smi *smi) ...@@ -545,7 +546,7 @@ static int rtl8366rb_setup_cascaded_irq(struct realtek_smi *smi)
"RTL8366RB", smi); "RTL8366RB", smi);
if (ret) { if (ret) {
dev_err(smi->dev, "unable to request irq: %d\n", ret); dev_err(smi->dev, "unable to request irq: %d\n", ret);
return ret; goto out_put_node;
} }
smi->irqdomain = irq_domain_add_linear(intc, smi->irqdomain = irq_domain_add_linear(intc,
RTL8366RB_NUM_INTERRUPT, RTL8366RB_NUM_INTERRUPT,
...@@ -553,12 +554,15 @@ static int rtl8366rb_setup_cascaded_irq(struct realtek_smi *smi) ...@@ -553,12 +554,15 @@ static int rtl8366rb_setup_cascaded_irq(struct realtek_smi *smi)
smi); smi);
if (!smi->irqdomain) { if (!smi->irqdomain) {
dev_err(smi->dev, "failed to create IRQ domain\n"); dev_err(smi->dev, "failed to create IRQ domain\n");
return -EINVAL; ret = -EINVAL;
goto out_put_node;
} }
for (i = 0; i < smi->num_ports; i++) for (i = 0; i < smi->num_ports; i++)
irq_set_parent(irq_create_mapping(smi->irqdomain, i), irq); irq_set_parent(irq_create_mapping(smi->irqdomain, i), irq);
return 0; out_put_node:
of_node_put(intc);
return ret;
} }
static int rtl8366rb_set_addr(struct realtek_smi *smi) static int rtl8366rb_set_addr(struct realtek_smi *smi)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment