Fix the following sparse warnings:

drivers/usb/gadget/net2272.c:916:13: warning: Using plain integer as NULL 
pointer
drivers/usb/gadget/net2272.c:1624:9: warning: Using plain integer as NULL 
pointer
drivers/usb/gadget/net2272.c:1552:30: warning: right shift by bigger than 
source value

Note that the last warning is an actual bug,
since ep->dma is a one bit value which is
shifted by one bit in code.

Signed-off-by: Felipe Balbi <ba...@ti.com>
---

Hi Alan,

found this when building drivers/usb/gadget/ with sparse
checks. I'm only concerned about the second hunk. Do
you think it's correct ? I don't have HW to test neither
do I have documentation to read.

 drivers/usb/gadget/net2272.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/gadget/net2272.c b/drivers/usb/gadget/net2272.c
index 32524b63..9cc3ca8 100644
--- a/drivers/usb/gadget/net2272.c
+++ b/drivers/usb/gadget/net2272.c
@@ -913,7 +913,7 @@ net2272_queue(struct usb_ep *_ep, struct usb_request *_req, 
gfp_t gfp_flags)
                        }
                }
        }
-       if (likely(req != 0))
+       if (likely(req))
                list_add_tail(&req->queue, &ep->queue);
 
        if (likely(!list_empty(&ep->queue)))
@@ -1549,7 +1549,7 @@ net2272_handle_dma(struct net2272_ep *ep)
              | (ep->dev->dma_eot_polarity << EOT_POLARITY)
              | (ep->dev->dma_dack_polarity << DACK_POLARITY)
              | (ep->dev->dma_dreq_polarity << DREQ_POLARITY)
-             | ((ep->dma >> 1) << DMA_ENDPOINT_SELECT));
+             | (ep->dma << DMA_ENDPOINT_SELECT));
 
        ep->dev->dma_busy = 0;
 
@@ -1622,7 +1622,7 @@ net2272_handle_ep(struct net2272_ep *ep)
        ep->irqs++;
 
        dev_vdbg(ep->dev->dev, "%s ack ep_stat0 %02x, ep_stat1 %02x, req %p\n",
-               ep->ep.name, stat0, stat1, req ? &req->req : 0);
+               ep->ep.name, stat0, stat1, req ? &req->req : NULL);
 
        net2272_ep_write(ep, EP_STAT0, stat0 &
                ~((1 << NAK_OUT_PACKETS)
-- 
1.8.2

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to