ia64/xen-unstable

changeset 1316:cd4da543a120

bitkeeper revision 1.876 (408910b0l_pMz-kCs2Q02jsIzb-VLw)

Fix refcnt bug.
author kaf24@scramble.cl.cam.ac.uk
date Fri Apr 23 12:48:48 2004 +0000 (2004-04-23)
parents a823ac69d295
children 1acac2de0d7c
files xen/common/physdev.c
line diff
     1.1 --- a/xen/common/physdev.c	Thu Apr 22 18:19:50 2004 +0000
     1.2 +++ b/xen/common/physdev.c	Fri Apr 23 12:48:48 2004 +0000
     1.3 @@ -125,6 +125,7 @@ int physdev_pci_access_modify(
     1.4  {
     1.5      struct task_struct *p;
     1.6      struct pci_dev *pdev, *rdev, *tdev;
     1.7 +    int rc = 0;
     1.8   
     1.9      if ( !IS_PRIV(current) )
    1.10          BUG();
    1.11 @@ -150,18 +151,19 @@ int physdev_pci_access_modify(
    1.12      if ( (pdev = pci_find_slot(bus, PCI_DEVFN(dev, func))) == NULL )
    1.13      {
    1.14          INFO("  dev does not exist\n");
    1.15 -        return -ENODEV;
    1.16 +        rc = -ENODEV;
    1.17 +        goto out;
    1.18      }
    1.19      add_dev_to_task(p, pdev, ACC_WRITE);
    1.20      INFO("  add RW %02x:%02x:%02x\n", pdev->bus->number,
    1.21           PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn));
    1.22  
    1.23 -
    1.24      /* Grant read access to the root device. */
    1.25      if ( (rdev = pci_find_slot(0, PCI_DEVFN(0, 0))) == NULL )
    1.26      {
    1.27          INFO("  bizarre -- no PCI root dev\n");
    1.28 -        return -ENODEV;
    1.29 +        rc = -ENODEV;
    1.30 +        goto out;
    1.31      }
    1.32      add_dev_to_task(p, rdev, ACC_READ);
    1.33      INFO("  add R0 %02x:%02x:%02x\n", 0, 0, 0);
    1.34 @@ -174,13 +176,13 @@ int physdev_pci_access_modify(
    1.35               PCI_SLOT(tdev->devfn), PCI_FUNC(tdev->devfn));
    1.36      }
    1.37  
    1.38 -    if ( pdev->hdr_type == PCI_HEADER_TYPE_NORMAL )
    1.39 -        return 0;
    1.40 -    
    1.41 -    /* The device is a bridge or cardbus. */
    1.42 -    INFO("XXX can't give access to bridge devices yet\n");
    1.43 +    /* Is the device a bridge or cardbus? */
    1.44 +    if ( pdev->hdr_type != PCI_HEADER_TYPE_NORMAL )
    1.45 +        INFO("XXX can't give access to bridge devices yet\n");
    1.46  
    1.47 -    return 0;
    1.48 + out:
    1.49 +    put_task_struct(p);
    1.50 +    return rc;
    1.51  }
    1.52  
    1.53  /* check if a domain has general access to a device */