* [PATCH 0/3] usb: cdns3: improvement for usb-next
@ 2020-06-23 3:09 Peter Chen
2020-06-23 3:09 ` [PATCH 1/3] usb: cdns3: ep0: delete the duplicate code Peter Chen
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Peter Chen @ 2020-06-23 3:09 UTC (permalink / raw)
To: balbi, gregkh; +Cc: linux-usb, linux-imx, pawell, rogerq, jun.li, 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
drivers/usb/cdns3/ep0.c | 2 +-
drivers/usb/cdns3/gadget.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] usb: cdns3: ep0: delete the duplicate code
2020-06-23 3:09 [PATCH 0/3] usb: cdns3: improvement for usb-next Peter Chen
@ 2020-06-23 3:09 ` Peter Chen
2020-06-23 3:10 ` [PATCH 2/3] usb: cdns3: gadget: unsigned int is dereferenced as a wider unsigned long Peter Chen
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Peter Chen @ 2020-06-23 3:09 UTC (permalink / raw)
To: balbi, gregkh; +Cc: linux-usb, linux-imx, pawell, rogerq, jun.li, Peter Chen
The value '0' is duplicated with USB_DIR_OUT
Signed-off-by: Peter Chen <peter.chen@nxp.com>
---
drivers/usb/cdns3/ep0.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/cdns3/ep0.c b/drivers/usb/cdns3/ep0.c
index 5aa69980e7ff..a2b9af5a80cc 100644
--- a/drivers/usb/cdns3/ep0.c
+++ b/drivers/usb/cdns3/ep0.c
@@ -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));
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] usb: cdns3: gadget: unsigned int is dereferenced as a wider unsigned long
2020-06-23 3:09 [PATCH 0/3] usb: cdns3: improvement for usb-next Peter Chen
2020-06-23 3:09 ` [PATCH 1/3] usb: cdns3: ep0: delete the duplicate code Peter Chen
@ 2020-06-23 3:10 ` Peter Chen
2020-06-23 3:10 ` [PATCH 3/3] usb: cdns3: gadget: use unsigned int for 32-bit number Peter Chen
2020-06-23 9:30 ` [PATCH 0/3] usb: cdns3: improvement for usb-next Roger Quadros
3 siblings, 0 replies; 5+ messages in thread
From: Peter Chen @ 2020-06-23 3:10 UTC (permalink / raw)
To: balbi, gregkh; +Cc: linux-usb, linux-imx, pawell, rogerq, jun.li, Peter Chen
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(-)
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 *)®,
+ for_each_set_bit(bit, ®,
sizeof(u32) * BITS_PER_BYTE) {
cdns3_check_ep_interrupt_proceed(priv_dev->eps[bit]);
ret = IRQ_HANDLED;
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] usb: cdns3: gadget: use unsigned int for 32-bit number
2020-06-23 3:09 [PATCH 0/3] usb: cdns3: improvement for usb-next Peter Chen
2020-06-23 3:09 ` [PATCH 1/3] usb: cdns3: ep0: delete the duplicate code Peter Chen
2020-06-23 3:10 ` [PATCH 2/3] usb: cdns3: gadget: unsigned int is dereferenced as a wider unsigned long Peter Chen
@ 2020-06-23 3:10 ` Peter Chen
2020-06-23 9:30 ` [PATCH 0/3] usb: cdns3: improvement for usb-next Roger Quadros
3 siblings, 0 replies; 5+ messages in thread
From: Peter Chen @ 2020-06-23 3:10 UTC (permalink / raw)
To: balbi, gregkh; +Cc: linux-usb, linux-imx, pawell, rogerq, jun.li, Peter Chen
If it is 'int', it can't stands for the highest bit for 32-bit
number, since the largest 'int' is 0x7fffffff.
Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
---
drivers/usb/cdns3/gadget.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c
index 2362faf7efeb..ecd395397e2c 100644
--- a/drivers/usb/cdns3/gadget.c
+++ b/drivers/usb/cdns3/gadget.c
@@ -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);
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] usb: cdns3: improvement for usb-next
2020-06-23 3:09 [PATCH 0/3] usb: cdns3: improvement for usb-next Peter Chen
` (2 preceding siblings ...)
2020-06-23 3:10 ` [PATCH 3/3] usb: cdns3: gadget: use unsigned int for 32-bit number Peter Chen
@ 2020-06-23 9:30 ` Roger Quadros
3 siblings, 0 replies; 5+ messages in thread
From: Roger Quadros @ 2020-06-23 9:30 UTC (permalink / raw)
To: Peter Chen, balbi, gregkh; +Cc: linux-usb, linux-imx, pawell, jun.li
Hi,
On 23/06/2020 06:09, Peter Chen wrote:
> 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.
Acked-by: Roger Quadros <rogerq@ti.com>
>
> drivers/usb/cdns3/ep0.c | 2 +-
> drivers/usb/cdns3/gadget.c | 6 +++---
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
--
cheers,
-roger
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-06-23 9:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-23 3:09 [PATCH 0/3] usb: cdns3: improvement for usb-next Peter Chen
2020-06-23 3:09 ` [PATCH 1/3] usb: cdns3: ep0: delete the duplicate code Peter Chen
2020-06-23 3:10 ` [PATCH 2/3] usb: cdns3: gadget: unsigned int is dereferenced as a wider unsigned long Peter Chen
2020-06-23 3:10 ` [PATCH 3/3] usb: cdns3: gadget: use unsigned int for 32-bit number Peter Chen
2020-06-23 9:30 ` [PATCH 0/3] usb: cdns3: improvement for usb-next Roger Quadros
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).