* [PATCH] staging: emxx_udc: use min helper macro for variable comparison
@ 2022-11-06 10:21 Deepak R Varma
0 siblings, 0 replies; only message in thread
From: Deepak R Varma @ 2022-11-06 10:21 UTC (permalink / raw)
To: Greg Kroah-Hartman, linux-staging, linux-kernel
Simplify code by using min helper macros in place of lengthy if/else
block oriented logical evaluation and value assignment. This issue is
identified by coccicheck using the minmax.cocci file.
Signed-off-by: Deepak R Varma <drv@mailo.com>
---
drivers/staging/emxx_udc/emxx_udc.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c
index b6abd3770e81..b4e19174bef2 100644
--- a/drivers/staging/emxx_udc/emxx_udc.c
+++ b/drivers/staging/emxx_udc/emxx_udc.c
@@ -1004,10 +1004,7 @@ static int _nbu2ss_in_dma(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep,
/* MAX Packet Size */
mpkt = _nbu2ss_readl(&preg->EP_REGS[num].EP_PCKT_ADRS) & EPN_MPKT;
- if ((DMA_MAX_COUNT * mpkt) < length)
- i_write_length = DMA_MAX_COUNT * mpkt;
- else
- i_write_length = length;
+ i_write_length = min(DMA_MAX_COUNT * mpkt, length);
/*------------------------------------------------------------*/
/* Number of transmission packets */
--
2.34.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-11-06 10:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-06 10:21 [PATCH] staging: emxx_udc: use min helper macro for variable comparison Deepak R Varma
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox