[2/3] usb: cdns3: gadget: unsigned int is dereferenced as a wider unsigned long

Message ID 20200623031001.8469-3-peter.chen@nxp.com
State New
Headers show
Series
  • usb: cdns3: improvement for usb-next
Related show

Commit Message

Peter Chen June 23, 2020, 3:10 a.m.
It is reported by Coverity scan, and fixed it by declare the reg as
unsigned long.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
---
 drivers/usb/cdns3/gadget.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch

diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c
index eac01b1a4958..2362faf7efeb 100644
--- a/drivers/usb/cdns3/gadget.c
+++ b/drivers/usb/cdns3/gadget.c
@@ -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 *)&reg,
+	for_each_set_bit(bit, &reg,
 			 sizeof(u32) * BITS_PER_BYTE) {
 		cdns3_check_ep_interrupt_proceed(priv_dev->eps[bit]);
 		ret = IRQ_HANDLED;