All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][next] USB: EHCI: ehci-mv: fix less than zero comparison of an unsigned int
@ 2020-05-15 16:54 ` Colin King
  0 siblings, 0 replies; 16+ messages in thread
From: Colin King @ 2020-05-15 16:54 UTC (permalink / raw)
  To: Alan Stern, Greg Kroah-Hartman, Zhang Shengju, Tang Bin, linux-usb
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

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>
---
 drivers/usb/host/ehci-mv.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/host/ehci-mv.c b/drivers/usb/host/ehci-mv.c
index 0d61f43c29dc..cffdc8d01b2a 100644
--- a/drivers/usb/host/ehci-mv.c
+++ b/drivers/usb/host/ehci-mv.c
@@ -166,11 +166,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 __iomem *) ehci_mv->cap_regs;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2020-05-16  9:25 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-15 16:54 [PATCH][next] USB: EHCI: ehci-mv: fix less than zero comparison of an unsigned int Colin King
2020-05-15 16:54 ` Colin King
2020-05-15 17:21 ` Alan Stern
2020-05-15 17:21   ` Alan Stern
2020-05-15 17:26   ` Colin Ian King
2020-05-15 17:26     ` Colin Ian King
2020-05-15 18:43     ` Alan Stern
2020-05-15 18:43       ` Alan Stern
2020-05-15 23:23   ` [PATCH][next] USB: EHCI: ehci-mv: fix less than zero comparisonof " Tang Bin
2020-05-15 23:23     ` Tang Bin
2020-05-16  1:17     ` Alan Stern
2020-05-16  1:17       ` Alan Stern
2020-05-16  6:30   ` [PATCH][next] USB: EHCI: ehci-mv: fix less than zero comparison of " Greg Kroah-Hartman
2020-05-16  6:30     ` Greg Kroah-Hartman
2020-05-16  9:25     ` Colin Ian King
2020-05-16  9:25       ` Colin Ian King

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.