staging: rtlwifi: use kcalloc instead of multiply
authorTobin C. Harding <me@tobin.cc>
Tue, 5 Sep 2017 06:53:43 +0000 (16:53 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 17 Sep 2017 14:35:26 +0000 (16:35 +0200)
checkpatch emits multiple warnings of type

WARNING:ALLOC_WITH_MULTIPLY: Prefer kcalloc over kzalloc with multiply

Replace two calls to kzalloc() with calls to kcalloc().

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtlwifi/efuse.c

index 6d5e657017c6a48ae781e62d88d46e503605bae7..d74c80d512c9ce6fa3e371af4f309f7519d01601 100644 (file)
@@ -252,12 +252,11 @@ void read_efuse(struct ieee80211_hw *hw, u16 _offset, u16 _size_byte, u8 *pbuf)
                            sizeof(u8), GFP_ATOMIC);
        if (!efuse_tbl)
                return;
-       efuse_word = kzalloc(EFUSE_MAX_WORD_UNIT * sizeof(u16 *), GFP_ATOMIC);
+       efuse_word = kcalloc(EFUSE_MAX_WORD_UNIT, sizeof(u16 *), GFP_ATOMIC);
        if (!efuse_word)
                goto out;
        for (i = 0; i < EFUSE_MAX_WORD_UNIT; i++) {
-               efuse_word[i] = kzalloc(efuse_max_section * sizeof(u16),
-                                       GFP_ATOMIC);
+               efuse_word[i] = kcalloc(efuse_max_section, sizeof(u16), GFP_ATOMIC);
                if (!efuse_word[i])
                        goto done;
        }