]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
staging: rtl8188eu: for loop instead of while loop used
authorIvan Safonov <insafonov@gmail.com>
Wed, 4 Nov 2015 11:58:41 +0000 (18:58 +0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 16 Nov 2015 04:02:47 +0000 (20:02 -0800)
The range of elements to fill with zeros is determined by using a roundup macro

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8188eu/hal/fw.c

index 8c0230125d00d13768b787eb6fa4510b684538d7..4d72537644b3ac8e5980b1a3cbc90c83350afb02 100644 (file)
@@ -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,