diff options
-rw-r--r-- | drivers/gpu/vga/vgaarb.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c index 1ac0c93603c9..ba7fa9ee54dc 100644 --- a/drivers/gpu/vga/vgaarb.c +++ b/drivers/gpu/vga/vgaarb.c | |||
@@ -954,6 +954,7 @@ static ssize_t vga_arb_write(struct file *file, const char __user * buf, | |||
954 | } | 954 | } |
955 | 955 | ||
956 | } else if (strncmp(curr_pos, "target ", 7) == 0) { | 956 | } else if (strncmp(curr_pos, "target ", 7) == 0) { |
957 | struct pci_bus *pbus; | ||
957 | unsigned int domain, bus, devfn; | 958 | unsigned int domain, bus, devfn; |
958 | struct vga_device *vgadev; | 959 | struct vga_device *vgadev; |
959 | 960 | ||
@@ -969,18 +970,31 @@ static ssize_t vga_arb_write(struct file *file, const char __user * buf, | |||
969 | ret_val = -EPROTO; | 970 | ret_val = -EPROTO; |
970 | goto done; | 971 | goto done; |
971 | } | 972 | } |
972 | 973 | pr_devel("vgaarb: %s ==> %x:%x:%x.%x\n", curr_pos, | |
973 | pdev = pci_get_bus_and_slot(bus, devfn); | 974 | domain, bus, PCI_SLOT(devfn), PCI_FUNC(devfn)); |
975 | |||
976 | pbus = pci_find_bus(domain, bus); | ||
977 | pr_devel("vgaarb: pbus %p\n", pbus); | ||
978 | if (pbus == NULL) { | ||
979 | pr_err("vgaarb: invalid PCI domain and/or bus address %x:%x\n", | ||
980 | domain, bus); | ||
981 | ret_val = -ENODEV; | ||
982 | goto done; | ||
983 | } | ||
984 | pdev = pci_get_slot(pbus, devfn); | ||
985 | pr_devel("vgaarb: pdev %p\n", pdev); | ||
974 | if (!pdev) { | 986 | if (!pdev) { |
975 | pr_info("vgaarb: invalid PCI address!\n"); | 987 | pr_err("vgaarb: invalid PCI address %x:%x\n", |
988 | bus, devfn); | ||
976 | ret_val = -ENODEV; | 989 | ret_val = -ENODEV; |
977 | goto done; | 990 | goto done; |
978 | } | 991 | } |
979 | } | 992 | } |
980 | 993 | ||
981 | vgadev = vgadev_find(pdev); | 994 | vgadev = vgadev_find(pdev); |
995 | pr_devel("vgaarb: vgadev %p\n", vgadev); | ||
982 | if (vgadev == NULL) { | 996 | if (vgadev == NULL) { |
983 | pr_info("vgaarb: this pci device is not a vga device\n"); | 997 | pr_err("vgaarb: this pci device is not a vga device\n"); |
984 | pci_dev_put(pdev); | 998 | pci_dev_put(pdev); |
985 | ret_val = -ENODEV; | 999 | ret_val = -ENODEV; |
986 | goto done; | 1000 | goto done; |
@@ -998,7 +1012,8 @@ static ssize_t vga_arb_write(struct file *file, const char __user * buf, | |||
998 | } | 1012 | } |
999 | } | 1013 | } |
1000 | if (i == MAX_USER_CARDS) { | 1014 | if (i == MAX_USER_CARDS) { |
1001 | pr_err("vgaarb: maximum user cards number reached!\n"); | 1015 | pr_err("vgaarb: maximum user cards (%d) number reached!\n", |
1016 | MAX_USER_CARDS); | ||
1002 | pci_dev_put(pdev); | 1017 | pci_dev_put(pdev); |
1003 | /* XXX: which value to return? */ | 1018 | /* XXX: which value to return? */ |
1004 | ret_val = -ENOMEM; | 1019 | ret_val = -ENOMEM; |