Skip to content

Commit

Permalink
net: lan966x: fix checking for return value of platform_get_irq_byname()
Browse files Browse the repository at this point in the history
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: Li Qiong <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Li Qiong authored and davem330 committed Aug 12, 2022
1 parent 75d8620 commit 40b4ac8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/net/ethernet/microchip/lan966x/lan966x_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -710,18 +710,18 @@ static void lan966x_cleanup_ports(struct lan966x *lan966x)
disable_irq(lan966x->xtr_irq);
lan966x->xtr_irq = -ENXIO;

if (lan966x->ana_irq) {
if (lan966x->ana_irq > 0) {
disable_irq(lan966x->ana_irq);
lan966x->ana_irq = -ENXIO;
}

if (lan966x->fdma)
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);

if (lan966x->ptp_ext_irq)
if (lan966x->ptp_ext_irq > 0)
devm_free_irq(lan966x->dev, lan966x->ptp_ext_irq, lan966x);
}

Expand Down Expand Up @@ -1049,7 +1049,7 @@ static int lan966x_probe(struct platform_device *pdev)
}

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,
lan966x_ana_irq_handler, IRQF_ONESHOT,
"ana irq", lan966x);
Expand Down

0 comments on commit 40b4ac8

Please sign in to comment.