summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2020-05-15 17:54:53 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-10-01 13:18:02 +0200
commitc3fa2949c2727f202cb9cca4966198b6378ef38f (patch)
tree041263787be0b5989d698e0c88c47e71da2e6cf9 /drivers/usb
parent89e6cf1c0ab5590ff134d89ac6c9b892d818d097 (diff)
USB: EHCI: ehci-mv: fix less than zero comparison of an unsigned int
[ Upstream commit a7f40c233a6b0540d28743267560df9cfb571ca9 ] 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: c856b4b0fdb5 ("USB: EHCI: ehci-mv: fix error handling in mv_ehci_probe()") Signed-off-by: Colin Ian King <colin.king@canonical.com> Link: https://lore.kernel.org/r/20200515165453.104028-1-colin.king@canonical.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/host/ehci-mv.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/usb/host/ehci-mv.c b/drivers/usb/host/ehci-mv.c
index 15b2e8910e9b..b6f196f5e252 100644
--- a/drivers/usb/host/ehci-mv.c
+++ b/drivers/usb/host/ehci-mv.c
@@ -156,11 +156,10 @@ static int mv_ehci_probe(struct platform_device *pdev)
hcd->rsrc_len = resource_size(r);
hcd->regs = ehci_mv->op_regs;
- hcd->irq = platform_get_irq(pdev, 0);
- if (hcd->irq < 0) {
- retval = hcd->irq;
+ retval = platform_get_irq(pdev, 0);
+ if (retval < 0)
goto err_disable_clk;
- }
+ hcd->irq = retval;
ehci = hcd_to_ehci(hcd);
ehci->caps = (struct ehci_caps *) ehci_mv->cap_regs;