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.mi...@qlogic.com>
Signed-off-by: Fengguang Wu <fengguang...@intel.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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to