[PATCH 2/3] staging: rtlwifi: use kcalloc instead of multiply
Larry Finger
Larry.Finger at lwfinger.net
Tue Sep 5 14:46:34 UTC 2017
On 09/05/2017 01:53 AM, Tobin C. Harding wrote:
> 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().
I have previously discussed this kind of change. This recommendation by
checkpatch.pl is just plain stupid!! NACK.
Larry
> ---
> drivers/staging/rtlwifi/efuse.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/rtlwifi/efuse.c b/drivers/staging/rtlwifi/efuse.c
> index 6d5e657..d74c80d 100644
> --- a/drivers/staging/rtlwifi/efuse.c
> +++ b/drivers/staging/rtlwifi/efuse.c
> @@ -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;
> }
>
More information about the devel
mailing list