usb: gadget: aspeed_udc: cleanup loop in ast_dma_descriptor_setup()
authorDan Carpenter <dan.carpenter@oracle.com>
Sat, 18 Jun 2022 08:54:20 +0000 (11:54 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 21 Jun 2022 14:30:31 +0000 (16:30 +0200)
commitc09b1f372e746aeeb61ef8ffe0fea3970fd9273e
treedfaebbea6e79f7a82571c3de04c0d30ac99a0728
parent3d393f0303b5120aa8c98a8ee70535ea9604ef20
usb: gadget: aspeed_udc: cleanup loop in ast_dma_descriptor_setup()

The "chunk >= 0" condition does not work because count is a u32.
Also, really we shouldn't enter the loop when "chunk" is zero.

Once that condition is fixed then there is no need for the "last"
variable.  I reversed the "if (chunk <= ep->chunk_max)" as well.
The new loop is much simpler.

Fixes: 055276c13205 ("usb: gadget: add Aspeed ast2600 udc driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/Yq2SvM2bbrtSd1H9@kili
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/udc/aspeed_udc.c