diff options
author | Chen Gang <gang.chen.5i5j@gmail.com> | 2014-10-05 23:04:45 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2014-11-05 23:14:08 -0500 |
commit | 23cf1d006f1a32cebf7ac6910ac6bcf41adfd702 (patch) | |
tree | 49bae1bd2e35636615f857a3a3e4e23a9f5e70ea /drivers/pci | |
parent | f114040e3ea6e07372334ade75d1ee0775c355e1 (diff) |
xen/pcifront: Process failure for pcifront_(re)scan_root()
When pcifront_try_connect() finds no PCI roots, it falls back to calling
pcifront_scan_root() for 0000:00. If that fails, it used to switch to
XenbusStateConnected and return success (because xenbus_switch_state()
currently always succeeds).
If pcifront_scan_root() fails, leave the XenbusState unchanged and return
an error code.
Similarly, pcifront_attach_devices() falls back to calling
pcifront_rescan_root() for 0000:00. If that fails, it used to switch to
XenbusStateConnected and return an error code.
If pcifront_rescan_root() fails, leave the XenbusState unchanged and return
the error code.
[bhelgaas: changelog]
Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/xen-pcifront.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c index 116ca3746adb..93316504f567 100644 --- a/drivers/pci/xen-pcifront.c +++ b/drivers/pci/xen-pcifront.c | |||
@@ -866,6 +866,11 @@ static int pcifront_try_connect(struct pcifront_device *pdev) | |||
866 | xenbus_dev_error(pdev->xdev, err, | 866 | xenbus_dev_error(pdev->xdev, err, |
867 | "No PCI Roots found, trying 0000:00"); | 867 | "No PCI Roots found, trying 0000:00"); |
868 | err = pcifront_scan_root(pdev, 0, 0); | 868 | err = pcifront_scan_root(pdev, 0, 0); |
869 | if (err) { | ||
870 | xenbus_dev_fatal(pdev->xdev, err, | ||
871 | "Error scanning PCI root 0000:00"); | ||
872 | goto out; | ||
873 | } | ||
869 | num_roots = 0; | 874 | num_roots = 0; |
870 | } else if (err != 1) { | 875 | } else if (err != 1) { |
871 | if (err == 0) | 876 | if (err == 0) |
@@ -947,6 +952,11 @@ static int pcifront_attach_devices(struct pcifront_device *pdev) | |||
947 | xenbus_dev_error(pdev->xdev, err, | 952 | xenbus_dev_error(pdev->xdev, err, |
948 | "No PCI Roots found, trying 0000:00"); | 953 | "No PCI Roots found, trying 0000:00"); |
949 | err = pcifront_rescan_root(pdev, 0, 0); | 954 | err = pcifront_rescan_root(pdev, 0, 0); |
955 | if (err) { | ||
956 | xenbus_dev_fatal(pdev->xdev, err, | ||
957 | "Error scanning PCI root 0000:00"); | ||
958 | goto out; | ||
959 | } | ||
950 | num_roots = 0; | 960 | num_roots = 0; |
951 | } else if (err != 1) { | 961 | } else if (err != 1) { |
952 | if (err == 0) | 962 | if (err == 0) |