[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220407100459.3605-1-guozhengkui@vivo.com>
Date: Thu, 7 Apr 2022 18:04:52 +0800
From: Guo Zhengkui <guozhengkui@...o.com>
To: Felipe Balbi <balbi@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jakob Koschel <jakobkoschel@...il.com>,
Guo Zhengkui <guozhengkui@...o.com>,
Alan Stern <stern@...land.harvard.edu>,
Colin Ian King <colin.king@...el.com>,
linux-usb@...r.kernel.org (open list:USB GADGET/PERIPHERAL SUBSYSTEM),
linux-kernel@...r.kernel.org (open list)
Cc: zhengkui_guo@...look.com
Subject: [PATCH] usb: gadget: net2280: use swap() instead of open coding it
Address the following coccicheck warning:
drivers/usb/gadget/udc/net2280.c:940:20-21: WARNING opportunity for swap().
drivers/usb/gadget/udc/net2280.c:944:25-26: WARNING opportunity for swap().
by using swap() for the swapping of variable values and drop the tmp
variables (`tmp` and `end`) that are not needed any more.
Signed-off-by: Guo Zhengkui <guozhengkui@...o.com>
---
drivers/usb/gadget/udc/net2280.c | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/drivers/usb/gadget/udc/net2280.c b/drivers/usb/gadget/udc/net2280.c
index 051d024b369e..d6a68631354a 100644
--- a/drivers/usb/gadget/udc/net2280.c
+++ b/drivers/usb/gadget/udc/net2280.c
@@ -932,19 +932,11 @@ static void start_dma(struct net2280_ep *ep, struct net2280_request *req)
static inline void
queue_dma(struct net2280_ep *ep, struct net2280_request *req, int valid)
{
- struct net2280_dma *end;
- dma_addr_t tmp;
-
/* swap new dummy for old, link; fill and maybe activate */
- end = ep->dummy;
- ep->dummy = req->td;
- req->td = end;
-
- tmp = ep->td_dma;
- ep->td_dma = req->td_dma;
- req->td_dma = tmp;
+ swap(ep->dummy, req->td);
+ swap(ep->td_dma, req->td_dma);
- end->dmadesc = cpu_to_le32 (ep->td_dma);
+ req->td->dmadesc = cpu_to_le32 (ep->td_dma);
fill_dma_desc(ep, req, valid);
}
--
2.20.1
Powered by blists - more mailing lists