Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754668AbdHZNBa (ORCPT ); Sat, 26 Aug 2017 09:01:30 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:33712 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754628AbdHZNB3 (ORCPT ); Sat, 26 Aug 2017 09:01:29 -0400 From: Yurii Pavlenko To: Larry.Finger@lwfinger.net Cc: gregkh@linuxfoundation.org, kvalo@codeaurora.org, pkshih@realtek.com, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Yurii Pavlenko Subject: [PATCH] Staging rtlwifi efuse fix up a warning kzalloc Date: Sat, 26 Aug 2017 15:01:18 +0200 Message-Id: <1503752478-9732-1-git-send-email-pyldev@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1275 Lines: 39 Hello, I have attached a small patch to fix a warning "Prefer kcalloc over kzalloc with multiply" for efuse.c as part of challenge 10 of Eudyptula. Best regards, Yurii Pavlenko Signed-off-by: Yurii Pavlenko --- drivers/staging/rtlwifi/efuse.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtlwifi/efuse.c b/drivers/staging/rtlwifi/efuse.c index 6d5e657..520d4f2 100644 --- a/drivers/staging/rtlwifi/efuse.c +++ b/drivers/staging/rtlwifi/efuse.c @@ -248,15 +248,15 @@ void read_efuse(struct ieee80211_hw *hw, u16 _offset, u16 _size_byte, u8 *pbuf) } /* allocate memory for efuse_tbl and efuse_word */ - efuse_tbl = kzalloc(rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE] * + efuse_tbl = kcalloc(rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE], 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), + efuse_word[i] = kcalloc(efuse_max_section, sizeof(u16), GFP_ATOMIC); if (!efuse_word[i]) goto done; -- 2.7.4