@@ -779,6 +779,7 @@ static int nwl_pcie_probe(struct platform_device *pdev)
779
779
return - ENODEV ;
780
780
781
781
pcie = pci_host_bridge_priv (bridge );
782
+ platform_set_drvdata (pdev , pcie );
782
783
783
784
pcie -> dev = dev ;
784
785
@@ -801,13 +802,13 @@ static int nwl_pcie_probe(struct platform_device *pdev)
801
802
err = nwl_pcie_bridge_init (pcie );
802
803
if (err ) {
803
804
dev_err (dev , "HW Initialization failed\n" );
804
- return err ;
805
+ goto err_clk ;
805
806
}
806
807
807
808
err = nwl_pcie_init_irq_domain (pcie );
808
809
if (err ) {
809
810
dev_err (dev , "Failed creating IRQ Domain\n" );
810
- return err ;
811
+ goto err_clk ;
811
812
}
812
813
813
814
bridge -> sysdata = pcie ;
@@ -817,11 +818,24 @@ static int nwl_pcie_probe(struct platform_device *pdev)
817
818
err = nwl_pcie_enable_msi (pcie );
818
819
if (err < 0 ) {
819
820
dev_err (dev , "failed to enable MSI support: %d\n" , err );
820
- return err ;
821
+ goto err_clk ;
821
822
}
822
823
}
823
824
824
- return pci_host_probe (bridge );
825
+ err = pci_host_probe (bridge );
826
+ if (!err )
827
+ return 0 ;
828
+
829
+ err_clk :
830
+ clk_disable_unprepare (pcie -> clk );
831
+ return err ;
832
+ }
833
+
834
+ static void nwl_pcie_remove (struct platform_device * pdev )
835
+ {
836
+ struct nwl_pcie * pcie = platform_get_drvdata (pdev );
837
+
838
+ clk_disable_unprepare (pcie -> clk );
825
839
}
826
840
827
841
static struct platform_driver nwl_pcie_driver = {
@@ -831,5 +845,6 @@ static struct platform_driver nwl_pcie_driver = {
831
845
.of_match_table = nwl_pcie_of_match ,
832
846
},
833
847
.probe = nwl_pcie_probe ,
848
+ .remove_new = nwl_pcie_remove ,
834
849
};
835
850
builtin_platform_driver (nwl_pcie_driver );
0 commit comments