[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150930133328.GA193013@lkp-ib03>
Date: Wed, 30 Sep 2015 21:33:28 +0800
From: kbuild test robot <lkp@...el.com>
To: Yuval Mintz <Yuval.Mintz@...gic.com>
Cc: kbuild-all@...org, netdev@...r.kernel.org, Ariel.Elior@...gic.com,
Yuval.Mintz@...gic.com
Subject: [PATCH] qed: fix kzalloc-simple.cocci warnings
drivers/net/ethernet/qlogic/qed/qed_int.c:644:30-37: WARNING: kzalloc should be used for p_hwfn -> hw_info . p_igu_info, instead of kmalloc/memset
Use kzalloc rather than kmalloc followed by memset with 0
This considers some simple cases that are common and easy to validate
Note in particular that there are no ...s in the rule, so all of the
matched code has to be contiguous
Generated by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci
CC: Yuval Mintz <Yuval.Mintz@...gic.com>
Signed-off-by: Fengguang Wu <fengguang.wu@...el.com>
---
qed_int.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
--- a/drivers/net/ethernet/qlogic/qed/qed_int.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_int.c
@@ -641,13 +641,11 @@ int qed_int_igu_read_cam(struct qed_hwfn
u16 sb_id;
u16 prev_sb_id = 0xFF;
- p_hwfn->hw_info.p_igu_info = kmalloc(sizeof(*p_igu_info), GFP_ATOMIC);
+ p_hwfn->hw_info.p_igu_info = kzalloc(sizeof(*p_igu_info), GFP_ATOMIC);
if (!p_hwfn->hw_info.p_igu_info)
return -ENOMEM;
- memset(p_hwfn->hw_info.p_igu_info, 0, sizeof(*p_igu_info));
-
p_igu_info = p_hwfn->hw_info.p_igu_info;
/* Initialize base sb / sb cnt for PFs */
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists