[PATCH v2 06/12] staging: rtl8188eu: use memset instead of for loop
memset clearer than the for loop. Signed-off-by: Ivan Safonov --- drivers/staging/rtl8188eu/hal/fw.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/fw.c b/drivers/staging/rtl8188eu/hal/fw.c index 7f1df4d..298e3e8 100644 --- a/drivers/staging/rtl8188eu/hal/fw.c +++ b/drivers/staging/rtl8188eu/hal/fw.c @@ -77,12 +77,12 @@ static void _rtl88e_fw_block_write(struct adapter *adapt, static u32 _rtl88e_fill_dummy(u8 *pfwbuf, u32 pfwlen) { - u32 i; + u32 remain = round_up(pfwlen, 4) - pfwlen; - for (i = pfwlen; i < roundup(pfwlen, 4); i++) - pfwbuf[i] = 0; + if (remain) + memset(pfwbuf, 0, remain); - return i; + return pfwlen + remain; } static void _rtl88e_fw_page_write(struct adapter *adapt, -- 2.4.10 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 06/12] staging: rtl8188eu: use memset instead of for loop
memset clearer than the for loop. Signed-off-by: Ivan Safonov--- drivers/staging/rtl8188eu/hal/fw.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/fw.c b/drivers/staging/rtl8188eu/hal/fw.c index 7f1df4d..298e3e8 100644 --- a/drivers/staging/rtl8188eu/hal/fw.c +++ b/drivers/staging/rtl8188eu/hal/fw.c @@ -77,12 +77,12 @@ static void _rtl88e_fw_block_write(struct adapter *adapt, static u32 _rtl88e_fill_dummy(u8 *pfwbuf, u32 pfwlen) { - u32 i; + u32 remain = round_up(pfwlen, 4) - pfwlen; - for (i = pfwlen; i < roundup(pfwlen, 4); i++) - pfwbuf[i] = 0; + if (remain) + memset(pfwbuf, 0, remain); - return i; + return pfwlen + remain; } static void _rtl88e_fw_page_write(struct adapter *adapt, -- 2.4.10 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/