USB: make hcd->irq signed for error handling
Subsystems (2)
PATCH 1/1 USB: make hcd->irq signed for error handling
There is a bug in ehci_msm_probe() where we do:
hcd->irq = platform_get_irq(pdev, 0);
if (hcd->irq < 0) {The problem is that hcd->irq is unsigned so the error handling doesn't work. I have made it signed.
include/linux/usb/hcd.h +1 -1
@@ -143,7 +143,7 @@ struct usb_hcd { unsigned has_tt:1; /* Integrated TT in root hub */ unsigned amd_resume_bug:1; /* AMD remote wakeup quirk */ -unsigned int irq;/* irq allocated */ +int irq;/* irq allocated */ void __iomem *regs;/* device memory/io */ resource_size_t rsrc_start;/* memory/io resource start */ resource_size_t rsrc_len;/* memory/io resource length */
Quoted 15 lines · Dan Carpenter
There is a bug in
ehci_msm_probe()where we do:hcd->irq = platform_get_irq(pdev, 0); if (hcd->irq < 0) {The problem is that
hcd->irqis unsigned so the error handling doesn't work. I have made it signed.Signed-off-by Dan Carpenter <[email protected]>include/linux/usb/hcd.h +0
-0
include/linux/usb/hcd.h struct usb_hcd { · line 149
Quoted 8 lines
include/linux/usb/hcd.h +1
-1@@ -143,7 +143,7 @@ struct usb_hcd { unsigned has_tt:1; /* Integrated TT in root hub */ unsigned amd_resume_bug:1; /* AMD remote wakeup quirk */ -unsigned int irq;/* irq allocated */ +int irq;/* irq allocated */ void __iomem *regs;/* device memory/io */ resource_size_t rsrc_start;/* memory/io resource start */ resource_size_t rsrc_len;/* memory/io resource length */
The .irq member of struct pci_dev is also unsigned int. I suspect we shouldn't break with tradition. Besides, if you're going to change this then you really ought to change the second parameter of usb_hcd_request_irqs().
Why not simply fix ehci_msm_probe() instead? And while you're at it, do the same thing for ehci_hcd_tilegx_drv_probe() and ohci_hcd_tilegx_drv_probe().
Alan Stern