drivers/misc/c2port/c2port-duramar2150.c: checking for NULL instead of IS_ERR()
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / pci / xen-pcifront.c
index 966abc6054d7b625c18a5eeb854dc065b40d43c1..eb402f4f0e2f0b004bf9fad2c98f6cffadad7be0 100644 (file)
@@ -51,7 +51,7 @@ struct pcifront_device {
 };
 
 struct pcifront_sd {
-       int domain;
+       struct pci_sysdata sd;
        struct pcifront_device *pdev;
 };
 
@@ -65,7 +65,9 @@ static inline void pcifront_init_sd(struct pcifront_sd *sd,
                                    unsigned int domain, unsigned int bus,
                                    struct pcifront_device *pdev)
 {
-       sd->domain = domain;
+       /* Because we do not expose that information via XenBus. */
+       sd->sd.node = first_online_node;
+       sd->sd.domain = domain;
        sd->pdev = pdev;
 }
 
@@ -463,8 +465,8 @@ static int pcifront_scan_root(struct pcifront_device *pdev,
        dev_info(&pdev->xdev->dev, "Creating PCI Frontend Bus %04x:%02x\n",
                 domain, bus);
 
-       bus_entry = kmalloc(sizeof(*bus_entry), GFP_KERNEL);
-       sd = kmalloc(sizeof(*sd), GFP_KERNEL);
+       bus_entry = kzalloc(sizeof(*bus_entry), GFP_KERNEL);
+       sd = kzalloc(sizeof(*sd), GFP_KERNEL);
        if (!bus_entry || !sd) {
                err = -ENOMEM;
                goto err_out;
@@ -678,10 +680,9 @@ static int pcifront_connect_and_init_dma(struct pcifront_device *pdev)
        if (!pcifront_dev) {
                dev_info(&pdev->xdev->dev, "Installing PCI frontend\n");
                pcifront_dev = pdev;
-       } else {
-               dev_err(&pdev->xdev->dev, "PCI frontend already installed!\n");
+       } else
                err = -EEXIST;
-       }
+
        spin_unlock(&pcifront_dev_lock);
 
        if (!err && !swiotlb_nr_tbl()) {
@@ -848,7 +849,7 @@ static int pcifront_try_connect(struct pcifront_device *pdev)
                goto out;
 
        err = pcifront_connect_and_init_dma(pdev);
-       if (err) {
+       if (err && err != -EEXIST) {
                xenbus_dev_fatal(pdev->xdev, err,
                                 "Error setting up PCI Frontend");
                goto out;