diff options
Diffstat (limited to 'drivers/pci/syscall.c')
-rw-r--r-- | drivers/pci/syscall.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/pci/syscall.c b/drivers/pci/syscall.c index 9d37fec27f24..2ac050d7f8cf 100644 --- a/drivers/pci/syscall.c +++ b/drivers/pci/syscall.c | |||
@@ -23,14 +23,14 @@ sys_pciconfig_read(unsigned long bus, unsigned long dfn, | |||
23 | u8 byte; | 23 | u8 byte; |
24 | u16 word; | 24 | u16 word; |
25 | u32 dword; | 25 | u32 dword; |
26 | long err, cfg_ret; | 26 | long err; |
27 | long cfg_ret; | ||
27 | 28 | ||
28 | err = -EPERM; | ||
29 | if (!capable(CAP_SYS_ADMIN)) | 29 | if (!capable(CAP_SYS_ADMIN)) |
30 | goto error; | 30 | return -EPERM; |
31 | 31 | ||
32 | err = -ENODEV; | 32 | err = -ENODEV; |
33 | dev = pci_find_slot(bus, dfn); | 33 | dev = pci_get_bus_and_slot(bus, dfn); |
34 | if (!dev) | 34 | if (!dev) |
35 | goto error; | 35 | goto error; |
36 | 36 | ||
@@ -66,7 +66,8 @@ sys_pciconfig_read(unsigned long bus, unsigned long dfn, | |||
66 | case 4: | 66 | case 4: |
67 | err = put_user(dword, (unsigned int __user *)buf); | 67 | err = put_user(dword, (unsigned int __user *)buf); |
68 | break; | 68 | break; |
69 | }; | 69 | } |
70 | pci_dev_put(dev); | ||
70 | return err; | 71 | return err; |
71 | 72 | ||
72 | error: | 73 | error: |
@@ -83,7 +84,8 @@ error: | |||
83 | case 4: | 84 | case 4: |
84 | put_user(-1, (unsigned int __user *)buf); | 85 | put_user(-1, (unsigned int __user *)buf); |
85 | break; | 86 | break; |
86 | }; | 87 | } |
88 | pci_dev_put(dev); | ||
87 | return err; | 89 | return err; |
88 | } | 90 | } |
89 | 91 | ||
@@ -101,7 +103,7 @@ sys_pciconfig_write(unsigned long bus, unsigned long dfn, | |||
101 | if (!capable(CAP_SYS_ADMIN)) | 103 | if (!capable(CAP_SYS_ADMIN)) |
102 | return -EPERM; | 104 | return -EPERM; |
103 | 105 | ||
104 | dev = pci_find_slot(bus, dfn); | 106 | dev = pci_get_bus_and_slot(bus, dfn); |
105 | if (!dev) | 107 | if (!dev) |
106 | return -ENODEV; | 108 | return -ENODEV; |
107 | 109 | ||
@@ -137,8 +139,8 @@ sys_pciconfig_write(unsigned long bus, unsigned long dfn, | |||
137 | default: | 139 | default: |
138 | err = -EINVAL; | 140 | err = -EINVAL; |
139 | break; | 141 | break; |
140 | }; | 142 | } |
141 | unlock_kernel(); | 143 | unlock_kernel(); |
142 | 144 | pci_dev_put(dev); | |
143 | return err; | 145 | return err; |
144 | } | 146 | } |