Skip to contentSkip to conversation

smartpqi: fix unused variable pqi_pm_ops for clang

PATCH Applied Don Brace 2 participants 3 messages Feb 10, 2022 – Feb 15, 2022

Subsystems (2)
lore
Share & tools
lore

Don Brace

author maintainer
#0 lore raw

PATCH 1/1 smartpqi: fix unused variable pqi_pm_ops for clang

Driver added a new dev_pm_ops structure used only if CONFIG_PM is set. The CONFIG_PM MACRO needed to be moved up in the code to avoid the compiler warnings. The HUNK to move the location was missing from the above patch.

Found by kernel test robot by building driver with CONFIG_PM disabled.

Correct compiler warning

Quoted 1 line
Quoted 1 line

drivers/scsi/smartpqi/smartpqi_init.c:9067:32:

warning: unused variable 'pqi_pm_ops' [-Wunused-const-variable]

   static const struct dev_pm_ops pqi_pm_ops = {
                                  ^

1 warning generated.

Fixes c66e078ad89e ("scsi: smartpqi: Fix hibernate and suspend)"
---
 drivers/scsi/smartpqi/smartpqi_init.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/scsi/smartpqi/smartpqi_init.c +4 -0
index 61366642ea95..4611912ae261 100644
@@ -8951,6 +8951,8 @@ static void pqi_process_module_params(void)
 	pqi_process_lockup_action_param();
 }
 
+#if defined(CONFIG_PM)
+
 static inline enum bmic_flush_cache_shutdown_event pqi_get_flush_cache_shutdown_event(struct pci_dev *pci_dev)
 {
 	if (pci_dev->subsystem_vendor == PCI_VENDOR_ID_ADAPTEC2 && pci_dev->subsystem_device == 0x1304)
@@ -9073,6 +9075,8 @@ static const struct dev_pm_ops pqi_pm_ops = {
 	.restore = pqi_resume_or_restore,
 };
 
+#endif /* CONFIG_PM */
+
 /* Define the PCI IDs for the controllers that we support. */
 static const struct pci_device_id pqi_pci_id_table[] = {
 	{
Signature · 1 line
2.28.0.rc1.9.ge7ae437ac1
#1 lore raw

Don,

Quoted 6 lines

Driver added a new dev_pm_ops structure used only if CONFIG_PM is set. The CONFIG_PM MACRO needed to be moved up in the code to avoid the compiler warnings. The HUNK to move the location was missing from the above patch.

Found by kernel test robot by building driver with CONFIG_PM disabled.

Applied to 5.18/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#2 lore raw
In reply to Don Brace
Quoted 9 lines · Don Brace

Driver added a new dev_pm_ops structure used only if CONFIG_PM is set. The CONFIG_PM MACRO needed to be moved up in the code to avoid the compiler warnings. The HUNK to move the location was missing from the above patch.

Found by kernel test robot by building driver with CONFIG_PM disabled.

[...]

Applied to 5.18/scsi-queue, thanks!

[1/1] smartpqi: fix unused variable pqi_pm_ops for clang

      https://git.kernel.org/mkp/scsi/c/31b17c3aeb5e
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering