Commit a7f40c23 authored by Colin Ian King's avatar Colin Ian King Committed by Greg Kroah-Hartman

USB: EHCI: ehci-mv: fix less than zero comparison of an unsigned int

The comparison of hcd->irq to less than zero for an error check will
never be true because hcd->irq is an unsigned int.  Fix this by
assigning the int retval to the return of platform_get_irq and checking
this for the -ve error condition and assigning hcd->irq to retval.

Addresses-Coverity: ("Unsigned compared against 0")
Fixes: c856b4b0 ("USB: EHCI: ehci-mv: fix error handling in mv_ehci_probe()")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20200515165453.104028-1-colin.king@canonical.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 78ef1b1e
...@@ -166,11 +166,10 @@ static int mv_ehci_probe(struct platform_device *pdev) ...@@ -166,11 +166,10 @@ static int mv_ehci_probe(struct platform_device *pdev)
hcd->rsrc_len = resource_size(r); hcd->rsrc_len = resource_size(r);
hcd->regs = ehci_mv->op_regs; hcd->regs = ehci_mv->op_regs;
hcd->irq = platform_get_irq(pdev, 0); retval = platform_get_irq(pdev, 0);
if (hcd->irq < 0) { if (retval < 0)
retval = hcd->irq;
goto err_disable_clk; goto err_disable_clk;
} hcd->irq = retval;
ehci = hcd_to_ehci(hcd); ehci = hcd_to_ehci(hcd);
ehci->caps = (struct ehci_caps __iomem *) ehci_mv->cap_regs; ehci->caps = (struct ehci_caps __iomem *) ehci_mv->cap_regs;
......
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