Skip to contentSkip to conversation

vgaarb: use valid dev pointer in vgaarb_info()

PATCH Applied Arnd Bergmann 2 participants 2 messages Nov 22, 2016

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

PATCH 1/1 vgaarb: use valid dev pointer in vgaarb_info()

We now pass the device to the debug messages, but on non-x86, this is an invalid pointer in vga_arb_device_init:

drivers/gpu/vga/vgaarb.c: In function 'vga_arb_device_init':
drivers/gpu/vga/vgaarb.c:1467:4: error: 'dev' may be used uninitialized in this function [-Werror=maybe-uninitialized]

This moves the initialization of the dev pointer outside of the architecture #ifdef.

Fixes a75d68f62106 ("vgaarb: Use dev_printk() when possible")
---
 drivers/gpu/vga/vgaarb.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/vga/vgaarb.c +1 -2
index b3d27182edd9..0f5b2dd24507 100644
@@ -1407,7 +1407,6 @@ static int __init vga_arb_device_init(void)
 	int rc;
 	struct pci_dev *pdev;
 	struct vga_device *vgadev;
-	struct device *dev;
 
 	rc = misc_register(&vga_arb_device);
 	if (rc < 0)
@@ -1424,6 +1423,7 @@ static int __init vga_arb_device_init(void)
 		vga_arbiter_add_pci_device(pdev);
 
 	list_for_each_entry(vgadev, &vga_list, list) {
+		struct device *dev = &vgadev->pdev->dev;
 #if defined(CONFIG_X86) || defined(CONFIG_IA64)
 		/*
 		 * Override vga_arbiter_add_pci_device()'s I/O based detection
@@ -1438,7 +1438,6 @@ static int __init vga_arb_device_init(void)
 		int i;
 
 		limit = screen_info.lfb_base + screen_info.lfb_size;
-		dev = &vgadev->pdev->dev;
 
 		/* Does firmware framebuffer belong to us? */
 		for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
Signature · 6 lines
2.9.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw
Quoted 11 lines · Arnd Bergmann

We now pass the device to the debug messages, but on non-x86, this is an invalid pointer in vga_arb_device_init:

drivers/gpu/vga/vgaarb.c: In function 'vga_arb_device_init':
drivers/gpu/vga/vgaarb.c:1467:4: error: 'dev' may be used uninitialized in this function [-Werror=maybe-uninitialized]

This moves the initialization of the dev pointer outside of the architecture #ifdef.

Fixes a75d68f62106 ("vgaarb: Use dev_printk() when possible")

Applied, thx.
-Daniel

Quoted 39 lines
---
 drivers/gpu/vga/vgaarb.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/vga/vgaarb.c +1 -2
index b3d27182edd9..0f5b2dd24507 100644
@@ -1407,7 +1407,6 @@ static int __init vga_arb_device_init(void)
 	int rc;
 	struct pci_dev *pdev;
 	struct vga_device *vgadev;
-	struct device *dev;
 
 	rc = misc_register(&vga_arb_device);
 	if (rc < 0)
@@ -1424,6 +1423,7 @@ static int __init vga_arb_device_init(void)
 		vga_arbiter_add_pci_device(pdev);
 
 	list_for_each_entry(vgadev, &vga_list, list) {
+		struct device *dev = &vgadev->pdev->dev;
 #if defined(CONFIG_X86) || defined(CONFIG_IA64)
 		/*
 		 * Override vga_arbiter_add_pci_device()'s I/O based detection
@@ -1438,7 +1438,6 @@ static int __init vga_arb_device_init(void)
 		int i;
 
 		limit = screen_info.lfb_base + screen_info.lfb_size;
-		dev = &vgadev->pdev->dev;
 
 		/* Does firmware framebuffer belong to us? */
 		for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
Signature · 6 lines
2.9.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch