scsi: megaraid: Fix set but unused variable
authorDamien Le Moal <damien.lemoal@wdc.com>
Mon, 6 Jul 2020 12:33:51 +0000 (21:33 +0900)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 8 Jul 2020 05:02:59 +0000 (01:02 -0400)
In megadev_ioctl(), if MEGA_HAVE_STATS is not defined, the variables
num_ldrv and ustats are unused. Conditionally define them to avoid compiler
warnings.

Link: https://lore.kernel.org/r/20200706123351.451959-1-damien.lemoal@wdc.com
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/megaraid.c

index 96ecf59..acd7c6e 100644 (file)
@@ -2975,14 +2975,13 @@ megadev_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
        void            *data = NULL;   /* data to be transferred */
        dma_addr_t      data_dma_hndl;  /* dma handle for data xfer area */
        megacmd_t       mc;
-       megastat_t      __user *ustats;
-       int             num_ldrv;
+#if MEGA_HAVE_STATS
+       megastat_t      __user *ustats = NULL;
+       int             num_ldrv = 0;
+#endif
        u32             uxferaddr = 0;
        struct pci_dev  *pdev;
 
-       ustats = NULL; /* avoid compilation warnings */
-       num_ldrv = 0;
-
        /*
         * Make sure only USCSICMD are issued through this interface.
         * MIMD application would still fire different command.