scsi: mvsas: Fix a set-but-not-used warning
authorBart Van Assche <bvanassche@acm.org>
Fri, 18 Feb 2022 19:51:03 +0000 (11:51 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 23 Feb 2022 02:11:06 +0000 (21:11 -0500)
This patch fixes the following compiler warning:

drivers/scsi/mvsas/mv_init.c: In function ‘mvs_pci_init’:
drivers/scsi/mvsas/mv_init.c:497:30: warning: variable ‘mpi’ set but not used [-Wunused-but-set-variable]
  497 |         struct mvs_prv_info *mpi;
      |                              ^~~

Link: https://lore.kernel.org/r/20220218195117.25689-36-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: John Garry <john.garry@huawei.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/mvsas/mv_init.c

index d12fb210c86864018606800a9d2cfa0d9e559a42..7ac63eb5ccd385292bbda62f7f6ade9edaa44597 100644 (file)
@@ -493,7 +493,6 @@ static int mvs_pci_init(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
        unsigned int rc, nhost = 0;
        struct mvs_info *mvi;
-       struct mvs_prv_info *mpi;
        irq_handler_t irq_handler = mvs_interrupt;
        struct Scsi_Host *shost = NULL;
        const struct mvs_chip_info *chip;
@@ -558,10 +557,13 @@ static int mvs_pci_init(struct pci_dev *pdev, const struct pci_device_id *ent)
                }
                nhost++;
        } while (nhost < chip->n_host);
-       mpi = (struct mvs_prv_info *)(SHOST_TO_SAS_HA(shost)->lldd_ha);
 #ifdef CONFIG_SCSI_MVSAS_TASKLET
+       {
+       struct mvs_prv_info *mpi = SHOST_TO_SAS_HA(shost)->lldd_ha;
+
        tasklet_init(&(mpi->mv_tasklet), mvs_tasklet,
                     (unsigned long)SHOST_TO_SAS_HA(shost));
+       }
 #endif
 
        mvs_post_sas_ha_init(shost, chip);