Port of a Linux commit 4a301766f5263dd94c1b95d1b1bbdf338afb1a37

  In several dwc-based drivers, ->host_init() can fail, so make sure to
  propagate and handle this to avoid continuing operation of a driver or
  hardware in an invalid state.

  Signed-off-by: Bjorn Andersson <[email protected]>
  Signed-off-by: Bjorn Helgaas <[email protected]>
  Acked-by: Joao Pinto <[email protected]>
  Acked-by: Jingoo Han <[email protected]>

Signed-off-by: Andrey Smirnov <[email protected]>
---
 drivers/pci/pci-imx6.c             | 4 +++-
 drivers/pci/pcie-designware-host.c | 7 +++++--
 drivers/pci/pcie-designware.h      | 2 +-
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/pci-imx6.c b/drivers/pci/pci-imx6.c
index 78aa5215a..1807f29c9 100644
--- a/drivers/pci/pci-imx6.c
+++ b/drivers/pci/pci-imx6.c
@@ -477,7 +477,7 @@ err_reset_phy:
        return ret;
 }
 
-static void imx6_pcie_host_init(struct pcie_port *pp)
+static int imx6_pcie_host_init(struct pcie_port *pp)
 {
        struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
        struct imx6_pcie *imx6_pcie = to_imx6_pcie(pci);
@@ -487,6 +487,8 @@ static void imx6_pcie_host_init(struct pcie_port *pp)
        imx6_pcie_deassert_core_reset(imx6_pcie);
        dw_pcie_setup_rc(pp);
        imx6_pcie_establish_link(imx6_pcie);
+
+       return 0;
 }
 
 static int imx6_pcie_link_up(struct dw_pcie *pci)
diff --git a/drivers/pci/pcie-designware-host.c 
b/drivers/pci/pcie-designware-host.c
index c00c6626f..9a9d4f9ae 100644
--- a/drivers/pci/pcie-designware-host.c
+++ b/drivers/pci/pcie-designware-host.c
@@ -164,8 +164,11 @@ int __init dw_pcie_host_init(struct pcie_port *pp)
        if (ret)
                pci->num_viewport = 2;
 
-       if (pp->ops->host_init)
-               pp->ops->host_init(pp);
+       if (pp->ops->host_init) {
+               ret = pp->ops->host_init(pp);
+               if (ret)
+                       return ret;
+       }
 
        pp->pci.parent = dev;
        pp->pci.pci_ops = &dw_pcie_ops;
diff --git a/drivers/pci/pcie-designware.h b/drivers/pci/pcie-designware.h
index f45d89a25..10f64b101 100644
--- a/drivers/pci/pcie-designware.h
+++ b/drivers/pci/pcie-designware.h
@@ -78,7 +78,7 @@ struct dw_pcie_host_ops {
                             unsigned int devfn, int where, int size, u32 *val);
        int (*wr_other_conf)(struct pcie_port *pp, struct pci_bus *bus,
                             unsigned int devfn, int where, int size, u32 val);
-       void (*host_init)(struct pcie_port *pp);
+       int (*host_init)(struct pcie_port *pp);
        void (*scan_bus)(struct pcie_port *pp);
 };
 
-- 
2.19.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to