Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f5578b6f authored by Sergey Shtylyov's avatar Sergey Shtylyov Committed by Greg Kroah-Hartman
Browse files

bcmgenet: add WOL IRQ check



commit 9deb48b53e7f4056c2eaa2dc2ee3338df619e4f6 upstream.

The driver neglects to check the result of platform_get_irq_optional()'s
call and blithely passes the negative error codes to devm_request_irq()
(which takes *unsigned* IRQ #), causing it to fail with -EINVAL.
Stop calling devm_request_irq() with the invalid IRQ #s.

Fixes: 8562056f ("net: bcmgenet: request Wake-on-LAN interrupt")
Signed-off-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
Acked-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 08f2078c
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -3516,10 +3516,12 @@ static int bcmgenet_probe(struct platform_device *pdev)

	/* Request the WOL interrupt and advertise suspend if available */
	priv->wol_irq_disabled = true;
	err = devm_request_irq(&pdev->dev, priv->wol_irq, bcmgenet_wol_isr, 0,
			       dev->name, priv);
	if (priv->wol_irq > 0) {
		err = devm_request_irq(&pdev->dev, priv->wol_irq,
				       bcmgenet_wol_isr, 0, dev->name, priv);
		if (!err)
			device_set_wakeup_capable(&pdev->dev, 1);
	}

	/* Set the needed headroom to account for any possible
	 * features enabling/disabling at runtime