Skip to contentSkip to conversation

scsi: buslogic: mark blogic_pci_tbl as __maybe_unused

PATCH In review Arnd Bergmann 3 participants 3 messages Jul 30, 2025 – Jul 31, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: buslogic: mark blogic_pci_tbl as __maybe_unused

From: Arnd Bergmann <[email protected]>

A previous patch removed an #ifdef check around the array definition, but this is not actually used when the driver is built-in, and now causes a warning when -Wunused-const-variable is set:

drivers/scsi/BusLogic.c:3727:35: error: 'blogic_pci_tbl' defined but not used [-Werror=unused-const-variable=]

Mark it as __maybe_unused for this configuration.

Ideally this should be fixed instead by using the array as part of a pci_driver definition, instead of the linux-2.4 style manual bus scan.

Fixes 204689f0ea20 ("scsi: Always define blogic_pci_tbl structure")

---
There are only a handful of unused const variables left in the kernel, and I would like to turn that warning on by default when they are all gone.

---
 drivers/scsi/BusLogic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/BusLogic.c +1 -1
index 08e12a3d6703..82597bd96525 100644
@@ -3724,7 +3724,7 @@ __setup("BusLogic=", blogic_setup);
 	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
 	{ }
 };*/
-static const struct pci_device_id blogic_pci_tbl[] = {
+static const struct pci_device_id blogic_pci_tbl[] __maybe_unused = {
 	{PCI_DEVICE(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER)},
 	{PCI_DEVICE(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC)},
 	{PCI_DEVICE(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT)},
Signature · 1 line
2.39.5
#1 lore raw

Hi Arnd!

Quoted 1 line
Fixes 204689f0ea20 ("scsi: Always define blogic_pci_tbl structure")

This commit did not go through SCSI so Alexey will have to handle your patch. But yes, I would like the scanning to be updated.

Signature · 1 line
Martin K. Petersen
Reviewed-by on v1 1/1
#2 lore raw
In reply to Arnd Bergmann
Quoted 8 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

A previous patch removed an #ifdef check around the array definition, but this is not actually used when the driver is built-in, and now causes a warning when -Wunused-const-variable is set:

drivers/scsi/BusLogic.c:3727:35: error: 'blogic_pci_tbl' defined but not used [-Werror=unused-const-variable=]

Quoted 8 lines

Mark it as __maybe_unused for this configuration.

Ideally this should be fixed instead by using the array as part of a pci_driver definition, instead of the linux-2.4 style manual bus scan.

Fixes 204689f0ea20 ("scsi: Always define blogic_pci_tbl structure")
Signature · 2 lines
Damien Le Moal
Western Digital Research