diff mbox series

scsi: qla2xxx: Fix unused variable warning in qla2xxx_process_purls_pkt()

Message ID 20230829-qla_nvme-fix-unused-fcport-v1-1-51c7560ecaee@kernel.org
State New
Headers show
Series scsi: qla2xxx: Fix unused variable warning in qla2xxx_process_purls_pkt() | expand

Commit Message

Nathan Chancellor Aug. 29, 2023, 2:35 p.m. UTC
When CONFIG_NVME_FC is not set, fcport is unused:

  drivers/scsi/qla2xxx/qla_nvme.c: In function 'qla2xxx_process_purls_pkt':
  drivers/scsi/qla2xxx/qla_nvme.c:1183:20: warning: unused variable 'fcport' [-Wunused-variable]
   1183 |         fc_port_t *fcport = uctx->fcport;
        |                    ^~~~~~

While this preprocessor usage could be converted to a normal if
statement to allow the compiler to always see fcport as used, it is
equally easy to just eliminate the fcport variable and use uctx->fcport
directly.

Fixes: 27177862de96 ("scsi: qla2xxx: Fix nvme_fc_rcv_ls_req() undefined error")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Closes: https://lore.kernel.org/linux-next/20230828131304.269a2a40@canb.auug.org.au/
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202308290833.sKkoSSeO-lkp@intel.com/
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 drivers/scsi/qla2xxx/qla_nvme.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)


---
base-commit: 15924b0503630016dee4dbb945a8df4df659070b
change-id: 20230829-qla_nvme-fix-unused-fcport-5aae495edbf0

Best regards,

Comments

Nilesh Javali Aug. 30, 2023, 6:18 a.m. UTC | #1
Nathan,

> -----Original Message-----
> From: Nathan Chancellor <nathan@kernel.org>
> Sent: Tuesday, August 29, 2023 8:05 PM
> To: Nilesh Javali <njavali@marvell.com>; GR-QLogic-Storage-Upstream <GR-
> QLogic-Storage-Upstream@marvell.com>; martin.petersen@oracle.com
> Cc: jejb@linux.ibm.com; linux-scsi@vger.kernel.org; patches@lists.linux.dev;
> Stephen Rothwell <sfr@canb.auug.org.au>; kernel test robot
> <lkp@intel.com>; Nathan Chancellor <nathan@kernel.org>
> Subject: [PATCH] scsi: qla2xxx: Fix unused variable warning in
> qla2xxx_process_purls_pkt()
> 
> When CONFIG_NVME_FC is not set, fcport is unused:
> 
>   drivers/scsi/qla2xxx/qla_nvme.c: In function 'qla2xxx_process_purls_pkt':
>   drivers/scsi/qla2xxx/qla_nvme.c:1183:20: warning: unused variable 'fcport'
> [-Wunused-variable]
>    1183 |         fc_port_t *fcport = uctx->fcport;
>         |                    ^~~~~~
> 
> While this preprocessor usage could be converted to a normal if
> statement to allow the compiler to always see fcport as used, it is
> equally easy to just eliminate the fcport variable and use uctx->fcport
> directly.
> 
> Fixes: 27177862de96 ("scsi: qla2xxx: Fix nvme_fc_rcv_ls_req() undefined
> error")
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Closes: https://urldefense.proofpoint.com/v2/url?u=https-
> 3A__lore.kernel.org_linux-2Dnext_20230828131304.269a2a40-
> 40canb.auug.org.au_&d=DwICaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=7My57sf
> PbDDcMFJyBD6G2keJbhsQZV7WIf8SjB-450c&m=6Ro8-
> XNjZ2FqXJQ6yxxALfPjhQBPt3qotsZ0slrvdO2I2PvBdIBcXYnV6ksxtNob&s=EIdO
> bHzGhlc8MuLlNAP3tVnpj3lRS5z209cAp0C1HFs&e=
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://urldefense.proofpoint.com/v2/url?u=https-
> 3A__lore.kernel.org_oe-2Dkbuild-2Dall_202308290833.sKkoSSeO-2Dlkp-
> 40intel.com_&d=DwICaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=7My57sfPbDDc
> MFJyBD6G2keJbhsQZV7WIf8SjB-450c&m=6Ro8-
> XNjZ2FqXJQ6yxxALfPjhQBPt3qotsZ0slrvdO2I2PvBdIBcXYnV6ksxtNob&s=uW
> Wht4u9qk6xJ_cuaxRhHuQaSj3dEGb1JFaFVwIpagE&e=
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
>  drivers/scsi/qla2xxx/qla_nvme.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_nvme.c
> b/drivers/scsi/qla2xxx/qla_nvme.c
> index 62a67662cbf3..f9f4a7da2ed6 100644
> --- a/drivers/scsi/qla2xxx/qla_nvme.c
> +++ b/drivers/scsi/qla2xxx/qla_nvme.c
> @@ -1180,12 +1180,11 @@ static void
>  qla2xxx_process_purls_pkt(struct scsi_qla_host *vha, struct purex_item
> *item)
>  {
>  	struct qla_nvme_unsol_ctx *uctx = item->purls_context;
> -	fc_port_t *fcport = uctx->fcport;
>  	struct qla_nvme_lsrjt_pt_arg a;
>  	int ret = 1;
> 
>  #if (IS_ENABLED(CONFIG_NVME_FC))
> -	ret = nvme_fc_rcv_ls_req(fcport->nvme_remote_port, &uctx-
> >lsrsp,
> +	ret = nvme_fc_rcv_ls_req(uctx->fcport->nvme_remote_port,
> &uctx->lsrsp,
>  				 &item->iocb, item->size);
>  #endif
>  	if (ret) {
> 
> ---
> base-commit: 15924b0503630016dee4dbb945a8df4df659070b
> change-id: 20230829-qla_nvme-fix-unused-fcport-5aae495edbf0
> 
> Best regards,
> --
> Nathan Chancellor <nathan@kernel.org>

Thanks for the patch.
Acked-by: Nilesh Javali <njavali@marvell.com>
Bart Van Assche Aug. 30, 2023, 7:35 p.m. UTC | #2
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Martin K. Petersen Aug. 31, 2023, 1:13 a.m. UTC | #3
Nathan,

> When CONFIG_NVME_FC is not set, fcport is unused:
>
>   drivers/scsi/qla2xxx/qla_nvme.c: In function 'qla2xxx_process_purls_pkt':
>   drivers/scsi/qla2xxx/qla_nvme.c:1183:20: warning: unused variable 'fcport' [-Wunused-variable]
>    1183 |         fc_port_t *fcport = uctx->fcport;
>         |                    ^~~~~~

Applied to 6.6/scsi-staging, thanks!
Martin K. Petersen Sept. 5, 2023, 10:18 a.m. UTC | #4
On Tue, 29 Aug 2023 07:35:06 -0700, Nathan Chancellor wrote:

> When CONFIG_NVME_FC is not set, fcport is unused:
> 
>   drivers/scsi/qla2xxx/qla_nvme.c: In function 'qla2xxx_process_purls_pkt':
>   drivers/scsi/qla2xxx/qla_nvme.c:1183:20: warning: unused variable 'fcport' [-Wunused-variable]
>    1183 |         fc_port_t *fcport = uctx->fcport;
>         |                    ^~~~~~
> 
> [...]

Applied to 6.6/scsi-queue, thanks!

[1/1] scsi: qla2xxx: Fix unused variable warning in qla2xxx_process_purls_pkt()
      https://git.kernel.org/mkp/scsi/c/d4781807f050
diff mbox series

Patch

diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c
index 62a67662cbf3..f9f4a7da2ed6 100644
--- a/drivers/scsi/qla2xxx/qla_nvme.c
+++ b/drivers/scsi/qla2xxx/qla_nvme.c
@@ -1180,12 +1180,11 @@  static void
 qla2xxx_process_purls_pkt(struct scsi_qla_host *vha, struct purex_item *item)
 {
 	struct qla_nvme_unsol_ctx *uctx = item->purls_context;
-	fc_port_t *fcport = uctx->fcport;
 	struct qla_nvme_lsrjt_pt_arg a;
 	int ret = 1;
 
 #if (IS_ENABLED(CONFIG_NVME_FC))
-	ret = nvme_fc_rcv_ls_req(fcport->nvme_remote_port, &uctx->lsrsp,
+	ret = nvme_fc_rcv_ls_req(uctx->fcport->nvme_remote_port, &uctx->lsrsp,
 				 &item->iocb, item->size);
 #endif
 	if (ret) {