From: Vasyl Gomonovych <gomonovych@gmail.com>
To: davem@davemloft.net
Cc: Ariel.Elior@cavium.com, everest-linux-l2@cavium.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Vasyl Gomonovych <gomonovych@gmail.com>
Subject: [PATCH] qed: fix unnecessary call to memset cocci warnings
Date: Thu, 16 Nov 2017 23:04:08 +0100 [thread overview]
Message-ID: <1510869848-23889-1-git-send-email-gomonovych@gmail.com> (raw)
In-Reply-To: <1510775895-16258-1-git-send-email-gomonovych@gmail.com>
Use kzalloc rather than kmalloc followed by memset with 0
drivers/net/ethernet/qlogic/qed/qed_dcbx.c:1280:13-20: WARNING:
kzalloc should be used for dcbx_info, instead of kmalloc/memset
Generated by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci
Signed-off-by: Vasyl Gomonovych <gomonovych@gmail.com>
---
drivers/net/ethernet/qlogic/qed/qed_dcbx.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/qlogic/qed/qed_dcbx.c b/drivers/net/ethernet/qlogic/qed/qed_dcbx.c
index 8f6ccc0c39e5..cc9e0dfcee48 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_dcbx.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_dcbx.c
@@ -1277,11 +1277,10 @@ static struct qed_dcbx_get *qed_dcbnl_get_dcbx(struct qed_hwfn *hwfn,
{
struct qed_dcbx_get *dcbx_info;
- dcbx_info = kmalloc(sizeof(*dcbx_info), GFP_ATOMIC);
+ dcbx_info = kzalloc(sizeof(*dcbx_info), GFP_ATOMIC);
if (!dcbx_info)
return NULL;
- memset(dcbx_info, 0, sizeof(*dcbx_info));
if (qed_dcbx_query_params(hwfn, dcbx_info, type)) {
kfree(dcbx_info);
return NULL;
--
1.9.1
next prev parent reply other threads:[~2017-11-16 22:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-15 19:58 [PATCH] qed: fix unnecessary call to memset cocci warnings Vasyl Gomonovych
2017-11-16 1:37 ` David Miller
2017-11-16 21:35 ` Vasyl Gomonovych
2017-11-16 22:04 ` Vasyl Gomonovych [this message]
2017-11-17 15:59 ` Andy Shevchenko
2017-11-18 1:31 ` David Miller
2017-11-20 21:31 ` Vasyl Gomonovych
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=1510869848-23889-1-git-send-email-gomonovych@gmail.com \
--to=gomonovych@gmail.com \
--cc=Ariel.Elior@cavium.com \
--cc=davem@davemloft.net \
--cc=everest-linux-l2@cavium.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).