diff mbox series

scsi: lpfc: remove redundant pointer lp

Message ID 20221101115657.48267-1-colin.i.king@gmail.com
State New
Headers show
Series scsi: lpfc: remove redundant pointer lp | expand

Commit Message

Colin Ian King Nov. 1, 2022, 11:56 a.m. UTC
Pointer lp is being initialized and incremented but the result
is never read. The pointer is redundant and can be removed.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/scsi/lpfc/lpfc_els.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

Martin K. Petersen Nov. 8, 2022, 3:46 a.m. UTC | #1
Colin,

> Pointer lp is being initialized and incremented but the result
> is never read. The pointer is redundant and can be removed.

> @@ -9173,14 +9173,11 @@ lpfc_els_rcv_farpr(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
>  		   struct lpfc_nodelist  *ndlp)

Looks like this function has been dubious for a long time. From a quick
glance it doesn't appear to have done anything useful with those
variable assignments since back in the 4.x days.

James, please have a look.
kernel test robot Nov. 15, 2022, 7:07 a.m. UTC | #2
Hi Colin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on jejb-scsi/for-next linus/master v6.1-rc5 next-20221114]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Colin-Ian-King/scsi-lpfc-remove-redundant-pointer-lp/20221101-195936
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
patch link:    https://lore.kernel.org/r/20221101115657.48267-1-colin.i.king%40gmail.com
patch subject: [PATCH] scsi: lpfc: remove redundant pointer lp
config: arm-randconfig-c002-20221114
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 463da45892e2d2a262277b91b96f5f8c05dc25d0)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # https://github.com/intel-lab-lkp/linux/commit/e11ce9b9f1589e7088f17b72cd4df1c2c0bbb1d1
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Colin-Ian-King/scsi-lpfc-remove-redundant-pointer-lp/20221101-195936
        git checkout e11ce9b9f1589e7088f17b72cd4df1c2c0bbb1d1
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/scsi/lpfc/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   In file included from drivers/scsi/lpfc/lpfc_els.c:38:
   drivers/scsi/lpfc/lpfc_hw.h:850:19: warning: field portName within 'struct _ADISC' is less aligned than 'struct lpfc_name' and is usually due to 'struct _ADISC' being packed, which can lead to unaligned accesses [-Wunaligned-access]
           struct lpfc_name portName;
                            ^
   drivers/scsi/lpfc/lpfc_hw.h:851:19: warning: field nodeName within 'struct _ADISC' is less aligned than 'struct lpfc_name' and is usually due to 'struct _ADISC' being packed, which can lead to unaligned accesses [-Wunaligned-access]
           struct lpfc_name nodeName;
                            ^
   drivers/scsi/lpfc/lpfc_hw.h:881:19: warning: field FportName within 'struct _FAN' is less aligned than 'struct lpfc_name' and is usually due to 'struct _FAN' being packed, which can lead to unaligned accesses [-Wunaligned-access]
           struct lpfc_name FportName;
                            ^
   drivers/scsi/lpfc/lpfc_hw.h:882:19: warning: field FnodeName within 'struct _FAN' is less aligned than 'struct lpfc_name' and is usually due to 'struct _FAN' being packed, which can lead to unaligned accesses [-Wunaligned-access]
           struct lpfc_name FnodeName;
                            ^
   drivers/scsi/lpfc/lpfc_hw.h:922:19: warning: field portName within 'struct _RNID' is less aligned than 'struct lpfc_name' and is usually due to 'struct _RNID' being packed, which can lead to unaligned accesses [-Wunaligned-access]
           struct lpfc_name portName;
                            ^
   drivers/scsi/lpfc/lpfc_hw.h:923:19: warning: field nodeName within 'struct _RNID' is less aligned than 'struct lpfc_name' and is usually due to 'struct _RNID' being packed, which can lead to unaligned accesses [-Wunaligned-access]
           struct lpfc_name nodeName;
                            ^
   drivers/scsi/lpfc/lpfc_hw.h:926:4: warning: field un within 'struct _RNID' is less aligned than 'union (unnamed union at drivers/scsi/lpfc/lpfc_hw.h:924:2)' and is usually due to 'struct _RNID' being packed, which can lead to unaligned accesses [-Wunaligned-access]
           } un;
             ^
>> drivers/scsi/lpfc/lpfc_els.c:9175:22: warning: variable 'pcmd' set but not used [-Wunused-but-set-variable]
           struct lpfc_dmabuf *pcmd;
                               ^
   8 warnings generated.


vim +/pcmd +9175 drivers/scsi/lpfc/lpfc_els.c

dea3101e0a5c89 James Bottomley 2005-04-17  9156  
e59058c44025d7 James Smart     2008-08-24  9157  /**
3621a710a7dbb2 James Smart     2009-04-06  9158   * lpfc_els_rcv_farpr - Process an unsolicited farp response iocb
e59058c44025d7 James Smart     2008-08-24  9159   * @vport: pointer to a host virtual N_Port data structure.
e59058c44025d7 James Smart     2008-08-24  9160   * @cmdiocb: pointer to lpfc command iocb data structure.
e59058c44025d7 James Smart     2008-08-24  9161   * @ndlp: pointer to a node-list data structure.
e59058c44025d7 James Smart     2008-08-24  9162   *
e59058c44025d7 James Smart     2008-08-24  9163   * This routine processes Fibre Channel Address Resolution Protocol
e59058c44025d7 James Smart     2008-08-24  9164   * Response (FARPR) IOCB received as an ELS unsolicited event. It simply
e59058c44025d7 James Smart     2008-08-24  9165   * invokes the lpfc_els_rsp_acc() routine to the remote node to accept
e59058c44025d7 James Smart     2008-08-24  9166   * the FARP response request.
e59058c44025d7 James Smart     2008-08-24  9167   *
e59058c44025d7 James Smart     2008-08-24  9168   * Return code
e59058c44025d7 James Smart     2008-08-24  9169   *   0 - Successfully processed FARPR IOCB (currently always return 0)
e59058c44025d7 James Smart     2008-08-24  9170   **/
dea3101e0a5c89 James Bottomley 2005-04-17  9171  static int
2e0fef85e098f6 James Smart     2007-06-17  9172  lpfc_els_rcv_farpr(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
2e0fef85e098f6 James Smart     2007-06-17  9173  		   struct lpfc_nodelist  *ndlp)
dea3101e0a5c89 James Bottomley 2005-04-17  9174  {
dea3101e0a5c89 James Bottomley 2005-04-17 @9175  	struct lpfc_dmabuf *pcmd;
b27cbd55495093 Bart Van Assche 2019-03-28  9176  	uint32_t did;
dea3101e0a5c89 James Bottomley 2005-04-17  9177  
3bea83b68d5447 James Smart     2022-02-24  9178  	did = get_job_els_rsp64_did(vport->phba, cmdiocb);
d51cf5bd926c7d James Smart     2022-04-12  9179  	pcmd = cmdiocb->cmd_dmabuf;
dea3101e0a5c89 James Bottomley 2005-04-17  9180  
dea3101e0a5c89 James Bottomley 2005-04-17  9181  	/* FARP-RSP received from DID <did> */
e8b62011d88d6f James Smart     2007-08-02  9182  	lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
e8b62011d88d6f James Smart     2007-08-02  9183  			 "0600 FARP-RSP received from DID x%x\n", did);
dea3101e0a5c89 James Bottomley 2005-04-17  9184  	/* ACCEPT the Farp resp request */
51ef4c26891a73 James Smart     2007-08-02  9185  	lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL);
dea3101e0a5c89 James Bottomley 2005-04-17  9186  
dea3101e0a5c89 James Bottomley 2005-04-17  9187  	return 0;
dea3101e0a5c89 James Bottomley 2005-04-17  9188  }
dea3101e0a5c89 James Bottomley 2005-04-17  9189
diff mbox series

Patch

diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index 2b03210264bb..3f13fcf75fce 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -9173,14 +9173,11 @@  lpfc_els_rcv_farpr(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
 		   struct lpfc_nodelist  *ndlp)
 {
 	struct lpfc_dmabuf *pcmd;
-	uint32_t *lp;
 	uint32_t did;
 
 	did = get_job_els_rsp64_did(vport->phba, cmdiocb);
 	pcmd = cmdiocb->cmd_dmabuf;
-	lp = (uint32_t *)pcmd->virt;
 
-	lp++;
 	/* FARP-RSP received from DID <did> */
 	lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
 			 "0600 FARP-RSP received from DID x%x\n", did);