diff mbox series

[1/2] qla2xxx: Fix regression warnings

Message ID 20200403084018.30766-2-njavali@marvell.com (mailing list archive)
State Accepted
Headers show
Series Update qla2xxx driver bug fixes | expand

Commit Message

Nilesh Javali April 3, 2020, 8:40 a.m. UTC
drivers/scsi/qla2xxx/qla_dbg.c:2542:7: warning: The scope of the variable 'pbuf'
can be reduced. [variableScope]
drivers/scsi/qla2xxx/qla_init.c:3615:6: warning: Variable 'rc' is assigned a
value that is never used. [unreadVariable]
drivers/scsi/qla2xxx/qla_isr.c:81:11-29: WARNING: dma_alloc_coherent use in
rsp_els already zeroes out memory, so memset is not needed
drivers/scsi/qla2xxx/qla_mbx.c:4889:15-33: WARNING: dma_alloc_coherent use in
els_cmd_map already zeroes out memory, so memset is not needed

Signed-off-by: Nilesh Javali <njavali@marvell.com>
Reported-by: kbuild test robot <lkp@intel.com>
---
 drivers/scsi/qla2xxx/qla_dbg.c  | 2 +-
 drivers/scsi/qla2xxx/qla_init.c | 2 --
 drivers/scsi/qla2xxx/qla_isr.c  | 1 -
 drivers/scsi/qla2xxx/qla_mbx.c  | 2 --
 4 files changed, 1 insertion(+), 6 deletions(-)

Comments

Bart Van Assche April 3, 2020, 2:16 p.m. UTC | #1
On 2020-04-03 01:40, Nilesh Javali wrote:
> @@ -2547,6 +2546,7 @@ ql_dbg(uint level, scsi_qla_host_t *vha, uint id, const char *fmt, ...)
>  	vaf.va = &va;
>  
>  	if (!ql_mask_match(level)) {
> +		char pbuf[64];
>  		if (vha != NULL) {
>  			const struct pci_dev *pdev = vha->hw->pdev;
>  			/* <module-name> <msg-id>:<host> Message */

Has this patch been verified witch checkpatch? Did checkpatch report
"Missing a blank line after declarations"?

Thanks,

Bart.
Nilesh Javali April 6, 2020, 4:55 a.m. UTC | #2
Hi Bart,

> -----Original Message-----
> From: Bart Van Assche <bvanassche@acm.org>
> Sent: Friday, April 3, 2020 7:46 PM
> To: Nilesh Javali <njavali@marvell.com>; martin.petersen@oracle.com
> Cc: linux-scsi@vger.kernel.org; GR-QLogic-Storage-Upstream <GR-QLogic-
> Storage-Upstream@marvell.com>
> Subject: [EXT] Re: [PATCH 1/2] qla2xxx: Fix regression warnings
> 
> External Email
> 
> ----------------------------------------------------------------------
> On 2020-04-03 01:40, Nilesh Javali wrote:
> > @@ -2547,6 +2546,7 @@ ql_dbg(uint level, scsi_qla_host_t *vha, uint id,
> const char *fmt, ...)
> >  	vaf.va = &va;
> >
> >  	if (!ql_mask_match(level)) {
> > +		char pbuf[64];
> >  		if (vha != NULL) {
> >  			const struct pci_dev *pdev = vha->hw->pdev;
> >  			/* <module-name> <msg-id>:<host> Message */
> 
> Has this patch been verified witch checkpatch? Did checkpatch report
> "Missing a blank line after declarations"?

Yes, the patch was verified using checkpath and showed no warnings.

Thanks,
Nilesh
Roman Bolshakov April 13, 2020, 6:16 p.m. UTC | #3
On Fri, Apr 03, 2020 at 01:40:17AM -0700, Nilesh Javali wrote:
> drivers/scsi/qla2xxx/qla_dbg.c:2542:7: warning: The scope of the variable 'pbuf'
> can be reduced. [variableScope]
> drivers/scsi/qla2xxx/qla_init.c:3615:6: warning: Variable 'rc' is assigned a
> value that is never used. [unreadVariable]
> drivers/scsi/qla2xxx/qla_isr.c:81:11-29: WARNING: dma_alloc_coherent use in
> rsp_els already zeroes out memory, so memset is not needed
> drivers/scsi/qla2xxx/qla_mbx.c:4889:15-33: WARNING: dma_alloc_coherent use in
> els_cmd_map already zeroes out memory, so memset is not needed
> 

Hi Nilesh,

It would be good to mention the errors are from cppcheck,

Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com>

Thanks,
Roman
diff mbox series

Patch

diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index f301a8048b2f..0a9e084c1669 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -2539,7 +2539,6 @@  ql_dbg(uint level, scsi_qla_host_t *vha, uint id, const char *fmt, ...)
 {
 	va_list va;
 	struct va_format vaf;
-	char pbuf[64];
 
 	va_start(va, fmt);
 
@@ -2547,6 +2546,7 @@  ql_dbg(uint level, scsi_qla_host_t *vha, uint id, const char *fmt, ...)
 	vaf.va = &va;
 
 	if (!ql_mask_match(level)) {
+		char pbuf[64];
 		if (vha != NULL) {
 			const struct pci_dev *pdev = vha->hw->pdev;
 			/* <module-name> <msg-id>:<host> Message */
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 3e9b7a079554..496ead29b51e 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -3613,8 +3613,6 @@  qla24xx_detect_sfp(scsi_qla_host_t *vha)
 			ha->lr_distance = LR_DISTANCE_5K;
 	}
 
-	if (!vha->flags.init_done)
-		rc = QLA_SUCCESS;
 out:
 	ql_dbg(ql_dbg_async, vha, 0x507b,
 	    "SFP detect: %s-Range SFP %s (nvr=%x ll=%x lr=%x lrd=%x).\n",
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index a9e8513e1cf1..4d9ec7ee59cc 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -87,7 +87,6 @@  qla24xx_process_abts(struct scsi_qla_host *vha, void *pkt)
 	}
 
 	/* terminate exchange */
-	memset(rsp_els, 0, sizeof(*rsp_els));
 	rsp_els->entry_type = ELS_IOCB_TYPE;
 	rsp_els->entry_count = 1;
 	rsp_els->nport_handle = ~0;
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index 7cefe35d61d1..d6c991bd1bde 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -4894,8 +4894,6 @@  qla25xx_set_els_cmds_supported(scsi_qla_host_t *vha)
 		return QLA_MEMORY_ALLOC_FAILED;
 	}
 
-	memset(els_cmd_map, 0, ELS_CMD_MAP_SIZE);
-
 	els_cmd_map[index] |= 1 << bit;
 
 	mcp->mb[0] = MBC_SET_RNID_PARAMS;