From 08ecab13e1677396edcd57459e47d25272f9179b Mon Sep 17 00:00:00 2001 From: Ivan Safonov Date: Wed, 4 Nov 2015 18:58:41 +0700 Subject: [PATCH] staging: rtl8188eu: for loop instead of while loop used The range of elements to fill with zeros is determined by using a roundup macro Signed-off-by: Ivan Safonov Reviewed-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/hal/fw.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/fw.c b/drivers/staging/rtl8188eu/hal/fw.c index 8c0230125d00..4d72537644b3 100644 --- a/drivers/staging/rtl8188eu/hal/fw.c +++ b/drivers/staging/rtl8188eu/hal/fw.c @@ -77,18 +77,12 @@ static void _rtl88e_fw_block_write(struct adapter *adapt, static void _rtl88e_fill_dummy(u8 *pfwbuf, u32 *pfwlen) { - u32 fwlen = *pfwlen; - u8 remain = (u8)(fwlen % 4); + u32 i; - remain = (remain == 0) ? 0 : (4 - remain); + for (i = *pfwlen; i < roundup(*pfwlen, 4); i++) + pfwbuf[i] = 0; - while (remain > 0) { - pfwbuf[fwlen] = 0; - fwlen++; - remain--; - } - - *pfwlen = fwlen; + *pfwlen = i; } static void _rtl88e_fw_page_write(struct adapter *adapt, -- 2.20.1