]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
pci syscall.c: Switch to refcounting API
authorAlan Cox <alan@lxorguk.ukuu.org.uk>
Mon, 23 Apr 2007 13:57:37 +0000 (14:57 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 11 Jul 2007 23:02:07 +0000 (16:02 -0700)
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/pci/syscall.c

index 9d37fec27f24668d1ede8229439b82bb36561b61..2ac050d7f8cffbc12e57384ee96894917236c73e 100644 (file)
@@ -23,14 +23,14 @@ sys_pciconfig_read(unsigned long bus, unsigned long dfn,
        u8 byte;
        u16 word;
        u32 dword;
-       long err, cfg_ret;
+       long err;
+       long cfg_ret;
 
-       err = -EPERM;
        if (!capable(CAP_SYS_ADMIN))
-               goto error;
+               return -EPERM;
 
        err = -ENODEV;
-       dev = pci_find_slot(bus, dfn);
+       dev = pci_get_bus_and_slot(bus, dfn);
        if (!dev)
                goto error;
 
@@ -66,7 +66,8 @@ sys_pciconfig_read(unsigned long bus, unsigned long dfn,
        case 4:
                err = put_user(dword, (unsigned int __user *)buf);
                break;
-       };
+       }
+       pci_dev_put(dev);
        return err;
 
 error:
@@ -83,7 +84,8 @@ error:
        case 4:
                put_user(-1, (unsigned int __user *)buf);
                break;
-       };
+       }
+       pci_dev_put(dev);
        return err;
 }
 
@@ -101,7 +103,7 @@ sys_pciconfig_write(unsigned long bus, unsigned long dfn,
        if (!capable(CAP_SYS_ADMIN))
                return -EPERM;
 
-       dev = pci_find_slot(bus, dfn);
+       dev = pci_get_bus_and_slot(bus, dfn);
        if (!dev)
                return -ENODEV;
 
@@ -137,8 +139,8 @@ sys_pciconfig_write(unsigned long bus, unsigned long dfn,
        default:
                err = -EINVAL;
                break;
-       };
+       }
        unlock_kernel();
-
+       pci_dev_put(dev);
        return err;
 }