public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yurii Pavlenko <pyldev@gmail.com>
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 <pyldev@gmail.com>
Subject: [PATCH] Staging rtlwifi efuse fix up a warning kzalloc
Date: Sat, 26 Aug 2017 15:01:18 +0200	[thread overview]
Message-ID: <1503752478-9732-1-git-send-email-pyldev@gmail.com> (raw)

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 <pyldev@gmail.com>
---
 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

             reply	other threads:[~2017-08-26 13:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-26 13:01 Yurii Pavlenko [this message]
2017-08-26 14:48 ` [PATCH] Staging rtlwifi efuse fix up a warning kzalloc Larry Finger
2017-08-26 15:26   ` Joe Perches
2017-08-28  8:32     ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1503752478-9732-1-git-send-email-pyldev@gmail.com \
    --to=pyldev@gmail.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kvalo@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pkshih@realtek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox