Skip to contentSkip to conversation

media: ngene: avoid unused variable warning

PATCH In review Arnd Bergmann 2 participants 2 messages Mar 13, 2018 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: ngene: avoid unused variable warning

The newly added pdev variable is only used in an #ifdef, causing a build warning without CONFIG_PCI_MSI, unless we move the declaration inside the same #ifdef:

drivers/media/pci/ngene/ngene-core.c: In function 'ngene_start':
drivers/media/pci/ngene/ngene-core.c:1328:17: error: unused variable 'pdev' [-Werror=unused-variable]

Fixes 6795bf626482 ("media: ngene: convert kernellog printing from printk() to dev_*() macros")
---
 drivers/media/pci/ngene/ngene-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/pci/ngene/ngene-core.c +1 -1
index 3b9a1bfaf6c0..25f16833a475 100644
@@ -1325,7 +1325,6 @@ static int ngene_buffer_config(struct ngene *dev)
 
 static int ngene_start(struct ngene *dev)
 {
-	struct device *pdev = &dev->pci_dev->dev;
 	int stat;
 	int i;
 
@@ -1359,6 +1358,7 @@ static int ngene_start(struct ngene *dev)
 #ifdef CONFIG_PCI_MSI
 	/* enable MSI if kernel and card support it */
 	if (pci_msi_enabled() && dev->card_info->msi_supported) {
+		struct device *pdev = &dev->pci_dev->dev;
 		unsigned long flags;
 
 		ngwritel(0, NGENE_INT_ENABLE);
Signature · 1 line
2.9.0
Acked-by on v1 1/1
#1 lore raw

Am Tue, 13 Mar 2018 14:06:03 +0100
schrieb Arnd Bergmann <[email protected]>:

Quoted 9 lines

The newly added pdev variable is only used in an #ifdef, causing a build warning without CONFIG_PCI_MSI, unless we move the declaration inside the same #ifdef:

drivers/media/pci/ngene/ngene-core.c: In function 'ngene_start':
drivers/media/pci/ngene/ngene-core.c:1328:17: error: unused variable 'pdev' [-Werror=unused-variable]

Fixes 6795bf626482 ("media: ngene: convert kernellog printing from printk() to dev_*() macros")

Thanks!

Quoted 17 lines
---
 drivers/media/pci/ngene/ngene-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/pci/ngene/ngene-core.c +0 -1
index 3b9a1bfaf6c0..25f16833a475 100644
@@ -1325,7 +1325,6 @@ static int ngene_buffer_config(struct ngene *dev)
 
 static int ngene_start(struct ngene *dev)
 {
-	struct device *pdev = &dev->pci_dev->dev;
 	int stat;
 	int i;
 

drivers/media/pci/ngene/ngene-core.c static int ngene_start(struct ngene *dev) · line 1364

Quoted 7 lines
drivers/media/pci/ngene/ngene-core.c +1 -0
@@ -1359,6 +1358,7 @@ static int ngene_start(struct ngene *dev)
 #ifdef CONFIG_PCI_MSI
 	/* enable MSI if kernel and card support it */
 	if (pci_msi_enabled() && dev->card_info->msi_supported) {
+		struct device *pdev = &dev->pci_dev->dev;
 		unsigned long flags;
 
 		ngwritel(0, NGENE_INT_ENABLE);

Best regards,
Daniel Scheller

Signature · 1 line
https://github.com/herrnst