Commit 40b4ac88 authored by Li Qiong's avatar Li Qiong Committed by David S. Miller

net: lan966x: fix checking for return value of platform_get_irq_byname()

The platform_get_irq_byname() returns non-zero IRQ number
or negative error number. "if (irq)" always true, chang it
to "if (irq > 0)"
Signed-off-by: default avatarLi Qiong <liqiong@nfschina.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 75d8620d
...@@ -710,7 +710,7 @@ static void lan966x_cleanup_ports(struct lan966x *lan966x) ...@@ -710,7 +710,7 @@ static void lan966x_cleanup_ports(struct lan966x *lan966x)
disable_irq(lan966x->xtr_irq); disable_irq(lan966x->xtr_irq);
lan966x->xtr_irq = -ENXIO; lan966x->xtr_irq = -ENXIO;
if (lan966x->ana_irq) { if (lan966x->ana_irq > 0) {
disable_irq(lan966x->ana_irq); disable_irq(lan966x->ana_irq);
lan966x->ana_irq = -ENXIO; lan966x->ana_irq = -ENXIO;
} }
...@@ -718,10 +718,10 @@ static void lan966x_cleanup_ports(struct lan966x *lan966x) ...@@ -718,10 +718,10 @@ static void lan966x_cleanup_ports(struct lan966x *lan966x)
if (lan966x->fdma) if (lan966x->fdma)
devm_free_irq(lan966x->dev, lan966x->fdma_irq, lan966x); devm_free_irq(lan966x->dev, lan966x->fdma_irq, lan966x);
if (lan966x->ptp_irq) if (lan966x->ptp_irq > 0)
devm_free_irq(lan966x->dev, lan966x->ptp_irq, lan966x); devm_free_irq(lan966x->dev, lan966x->ptp_irq, lan966x);
if (lan966x->ptp_ext_irq) if (lan966x->ptp_ext_irq > 0)
devm_free_irq(lan966x->dev, lan966x->ptp_ext_irq, lan966x); devm_free_irq(lan966x->dev, lan966x->ptp_ext_irq, lan966x);
} }
...@@ -1049,7 +1049,7 @@ static int lan966x_probe(struct platform_device *pdev) ...@@ -1049,7 +1049,7 @@ static int lan966x_probe(struct platform_device *pdev)
} }
lan966x->ana_irq = platform_get_irq_byname(pdev, "ana"); lan966x->ana_irq = platform_get_irq_byname(pdev, "ana");
if (lan966x->ana_irq) { if (lan966x->ana_irq > 0) {
err = devm_request_threaded_irq(&pdev->dev, lan966x->ana_irq, NULL, err = devm_request_threaded_irq(&pdev->dev, lan966x->ana_irq, NULL,
lan966x_ana_irq_handler, IRQF_ONESHOT, lan966x_ana_irq_handler, IRQF_ONESHOT,
"ana irq", lan966x); "ana irq", lan966x);
......
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