Skip to content

Commit

Permalink
usb: host: ehci-msm: fix handling platform_get_irq result
Browse files Browse the repository at this point in the history
The function can return negative values.

The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2038576

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Andrzej Hajda authored and Greg Kroah-Hartman committed Oct 4, 2015
1 parent 8091e0c commit 0c43e9d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/usb/host/ehci-msm.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ static int ehci_msm_probe(struct platform_device *pdev)
return -ENOMEM;
}

hcd->irq = platform_get_irq(pdev, 0);
if (hcd->irq < 0) {
ret = platform_get_irq(pdev, 0);
if (ret < 0) {
dev_err(&pdev->dev, "Unable to get IRQ resource\n");
ret = hcd->irq;
goto put_hcd;
}
hcd->irq = ret;

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
Expand Down

0 comments on commit 0c43e9d

Please sign in to comment.