[PATCH] USB: UDC: use swap() to make code cleaner

From: davidcomponentone
Date: Wed Nov 03 2021 - 21:13:01 EST


From: Yang Guang <yang.guang5@xxxxxxxxxx>

Use the macro 'swap()' defined in 'include/linux/minmax.h' to avoid
opencoding it.

Reported-by: Zeal Robot <zealci@xxxxxxxxxx>
Signed-off-by: Yang Guang <yang.guang5@xxxxxxxxxx>
---
drivers/usb/gadget/udc/net2280.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/usb/gadget/udc/net2280.c b/drivers/usb/gadget/udc/net2280.c
index 16e7d2db6411..71e02bcebecd 100644
--- a/drivers/usb/gadget/udc/net2280.c
+++ b/drivers/usb/gadget/udc/net2280.c
@@ -933,16 +933,13 @@ 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->td_dma, req->td_dma);

end->dmadesc = cpu_to_le32 (ep->td_dma);

--
2.30.2