lpfc: Use kzalloc instead of kmalloc
authorPunit Vara <punitvara@gmail.com>
Wed, 16 Dec 2015 23:12:07 +0000 (18:12 -0500)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 22 Dec 2015 03:08:15 +0000 (22:08 -0500)
This patch is to the lpfc_els.c which resolves following warning
reported by coccicheck:

WARNING: kzalloc should be used for rdp_context, instead of
kmalloc/memset

Signed-off-by: Punit Vara <punitvara@gmail.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Reviewed-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Reviewed-by: Sebastian Herbszt <herbszt@gmx.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/lpfc/lpfc_els.c

index 273a1db5c5aabfaa8d80f99e4ea8caa7e9d5f533..7f5abb8f52bc82d1380e9c0dbd12a0ad7fca814a 100644 (file)
@@ -5016,13 +5016,12 @@ lpfc_els_rcv_rdp(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
        if (RDP_NPORT_ID_SIZE !=
                        be32_to_cpu(rdp_req->nport_id_desc.length))
                goto rjt_logerr;
-       rdp_context = kmalloc(sizeof(struct lpfc_rdp_context), GFP_KERNEL);
+       rdp_context = kzalloc(sizeof(struct lpfc_rdp_context), GFP_KERNEL);
        if (!rdp_context) {
                rjt_err = LSRJT_UNABLE_TPC;
                goto error;
        }
 
-       memset(rdp_context, 0, sizeof(struct lpfc_rdp_context));
        cmd = &cmdiocb->iocb;
        rdp_context->ndlp = lpfc_nlp_get(ndlp);
        rdp_context->ox_id = cmd->unsli3.rcvsli3.ox_id;