usb: cdns3: improvement for usb-next
Subsystems (3)
cover usb: cdns3: improvement for usb-next
Peter Chen (3):
usb: cdns3: ep0: delete the duplicate code
usb: cdns3: gadget: unsigned int is dereferenced as a wider unsigned
long
usb: cdns3: gadget: use unsigned int for 32-bit number
drivers/usb/cdns3/ep0.c | 2 +- drivers/usb/cdns3/gadget.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
Signature · 1 line
2.17.1
PATCH 1/3 usb: cdns3: ep0: delete the duplicate code
The value '0' is duplicated with USB_DIR_OUT
--- drivers/usb/cdns3/ep0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/cdns3/ep0.c +1 -1
@@ -610,7 +610,7 @@ static bool cdns3_check_new_setup(struct cdns3_device *priv_dev) {u32 ep_sts_reg; -cdns3_select_ep (priv_dev,0 |USB_DIR_OUT ); +cdns3_select_ep (priv_dev,USB_DIR_OUT ); ep_sts_reg =readl (&priv_dev->regs->ep_sts);return !!(ep_sts_reg & (EP_STS_SETUP |EP_STS_STPWAIT ));
Signature · 1 line
2.17.1
PATCH 2/3 usb: cdns3: gadget: unsigned int is dereferenced as a wider unsigned long
In reply to Peter ChenIt is reported by Coverity scan, and fixed it by declare the reg as unsigned long.
--- drivers/usb/cdns3/gadget.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/cdns3/gadget.c +2 -2
@@ -1813,7 +1813,7 @@ static irqreturn_t cdns3_device_thread_irq_handler(int irq, void *data)irqreturn_t ret =IRQ_NONE ;unsigned long flags;int bit; -u32 reg; +unsigned long reg;spin_lock_irqsave (&priv_dev->lock, flags);
@@ -1844,7 +1844,7 @@ static irqreturn_t cdns3_device_thread_irq_handler(int irq, void *data)if (!reg) goto irqend; -for_each_set_bit (bit, (unsigned long *)®, +for_each_set_bit (bit, ®,sizeof (u32) *BITS_PER_BYTE ) {cdns3_check_ep_interrupt_proceed (priv_dev->eps[bit]); ret =IRQ_HANDLED ;
Signature · 1 line
2.17.1
PATCH 3/3 usb: cdns3: gadget: use unsigned int for 32-bit number
In reply to Peter ChenIf it is 'int', it can't stands for the highest bit for 32-bit number, since the largest 'int' is 0x7fffffff.
--- drivers/usb/cdns3/gadget.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/cdns3/gadget.c +1 -1
@@ -1812,7 +1812,7 @@ static irqreturn_t cdns3_device_thread_irq_handler(int irq, void *data)struct cdns3_device *priv_dev = data;irqreturn_t ret =IRQ_NONE ;unsigned long flags; -int bit; +unsigned int bit;unsigned long reg;spin_lock_irqsave (&priv_dev->lock, flags);
Signature · 1 line
2.17.1
Hi,
Quoted 5 lines · Peter Chen
Peter Chen (3):
usb: cdns3: ep0: delete the duplicate code
usb: cdns3: gadget: unsigned int is dereferenced as a wider unsigned
long
usb: cdns3: gadget: use unsigned int for 32-bit number
For this series.
Quoted 5 lines
drivers/usb/cdns3/ep0.c | 2 +- drivers/usb/cdns3/gadget.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
Signature · 5 lines
cheers, -roger Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki