Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: raid_attrs: fix unused variable warning

I ran into a new warning on randconfig kernels:

drivers/scsi/raid_class.c: In function 'raid_match':
drivers/scsi/raid_class.c:64:24: error: unused variable 'i' [-Werror=unused-variable]

This looks like a very old problem that for some reason was very hard to
run into, but it is very easy to fix, by replacing the incorrect #ifdef
with a simpler IS_ENABLED() check.

Fixes: fac829fdcaf4 ("[SCSI] raid_attrs: fix dependency problems")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Arnd Bergmann and committed by
Martin K. Petersen
0eeec014 5b394b2d

+1 -3
+1 -3
drivers/scsi/raid_class.c
··· 63 63 * emulated RAID devices, so start with SCSI */ 64 64 struct raid_internal *i = ac_to_raid_internal(cont); 65 65 66 - #if defined(CONFIG_SCSI) || defined(CONFIG_SCSI_MODULE) 67 - if (scsi_is_sdev_device(dev)) { 66 + if (IS_ENABLED(CONFIG_SCSI) && scsi_is_sdev_device(dev)) { 68 67 struct scsi_device *sdev = to_scsi_device(dev); 69 68 70 69 if (i->f->cookie != sdev->host->hostt) ··· 71 72 72 73 return i->f->is_raid(dev); 73 74 } 74 - #endif 75 75 /* FIXME: look at other subsystems too */ 76 76 return 0; 77 77 }