From 23cf1d006f1a32cebf7ac6910ac6bcf41adfd702 Mon Sep 17 00:00:00 2001 From: Chen Gang Date: Mon, 6 Oct 2014 11:04:45 +0800 Subject: 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 Signed-off-by: Bjorn Helgaas Reviewed-by: Konrad Rzeszutek Wilk --- drivers/pci/xen-pcifront.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'drivers/pci/xen-pcifront.c') 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) xenbus_dev_error(pdev->xdev, err, "No PCI Roots found, trying 0000:00"); err = pcifront_scan_root(pdev, 0, 0); + if (err) { + xenbus_dev_fatal(pdev->xdev, err, + "Error scanning PCI root 0000:00"); + goto out; + } num_roots = 0; } else if (err != 1) { if (err == 0) @@ -947,6 +952,11 @@ static int pcifront_attach_devices(struct pcifront_device *pdev) xenbus_dev_error(pdev->xdev, err, "No PCI Roots found, trying 0000:00"); err = pcifront_rescan_root(pdev, 0, 0); + if (err) { + xenbus_dev_fatal(pdev->xdev, err, + "Error scanning PCI root 0000:00"); + goto out; + } num_roots = 0; } else if (err != 1) { if (err == 0) -- cgit v1.2.3-59-g8ed1b