Fix warning by coccicheck
Subsystems (3)
cover Fix warning by coccicheck
Punit Vara (2):
scsi: lpfc: Use kzalloc instead of kmalloc
scsi: remove useless casting value returned by kmalloc to structure
drivers/scsi/hpsa.c | 3 +-- drivers/scsi/lpfc/lpfc_els.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-)
Signature · 1 line
2.5.3
PATCH 1/2 scsi: lpfc: Use kzalloc instead of kmalloc
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
--- drivers/scsi/lpfc/lpfc_els.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_els.c +1 -1
@@ -4990,7 +4990,7 @@ 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;
Signature · 1 line
2.5.3
Re: [PATCH 1/2] scsi: lpfc: Use kzalloc instead of kmalloc
Hi Punit,
Aren't you missing the removal of the memset() as part of this conversion?
-matt
Quoted 26 lines · Punit Vara
This patch is to the
lpfc_els.cwhich resolves following warning reported by coccicheck:WARNING: kzalloc should be used for
rdp_context, instead of kmalloc/memsetSigned-off-by Punit Vara <[email protected]>---
drivers/scsi/lpfc/lpfc_els.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/scsi/lpfc/lpfc_els.c +1
-1@@ -4990,7 +4990,7 @@ 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;
Re: [PATCH 1/2] scsi: lpfc: Use kzalloc instead of kmalloc
Quoted 20 lines · Matthew R. Ochs
Hi Punit,
Aren't you missing the removal of the
memset()as part of this conversion?-matt
Quoted 13 lines · Punit Vara
This patch is to the
lpfc_els.cwhich resolves following warning reported by coccicheck:WARNING: kzalloc should be used for
rdp_context, instead of kmalloc/memsetSigned-off-by Punit Vara <[email protected]>---
drivers/scsi/lpfc/lpfc_els.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines
drivers/scsi/lpfc/lpfc_els.c lpfc_els_rcv_rdp(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, · line 4996
Quoted 13 lines
drivers/scsi/lpfc/lpfc_els.c +1
-1@@ -4990,7 +4990,7 @@ 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;
Thanks for reviewing my patches.
Can I send more patches ? my all previous patches already reviewed by you . Should I wait to apply this patch to tree or i can send new patch set ? Please suggest me sir.
PATCH 2/2 scsi: remove useless casting value returned by kmalloc to structure
In reply to Punit VaraThis is the patch to the hpsa.c file that resolves following warning reported by coccicheck:
WARNING: casting value returned by memory allocation function to (BIG_IOCTL_Command_struct *) is useless.
--- drivers/scsi/hpsa.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/hpsa.c +1 -2
@@ -6027,8 +6027,7 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h, void __user *argp)return -EINVAL ;if (!capable (CAP_SYS_RAWIO ))return -EPERM ; - ioc = (BIG_IOCTL_Command_struct *) -kmalloc (sizeof (*ioc),GFP_KERNEL ); + ioc =kmalloc (sizeof (*ioc),GFP_KERNEL );if (!ioc) { status = -ENOMEM ; goto cleanup1;
Signature · 1 line
2.5.3
Re: [PATCH 2/2] scsi: remove useless casting value returned by kmalloc to structure