File tree Expand file tree Collapse file tree
drivers/pci/controller/dwc Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -242,18 +242,24 @@ static struct pci_ops al_child_pci_ops = {
242242 .write = pci_generic_config_write ,
243243};
244244
245- static void al_pcie_config_prepare (struct al_pcie * pcie )
245+ static int al_pcie_config_prepare (struct al_pcie * pcie )
246246{
247247 struct al_pcie_target_bus_cfg * target_bus_cfg ;
248248 struct dw_pcie_rp * pp = & pcie -> pci -> pp ;
249249 unsigned int ecam_bus_mask ;
250+ struct resource_entry * ft ;
250251 u32 cfg_control_offset ;
252+ struct resource * bus ;
251253 u8 subordinate_bus ;
252254 u8 secondary_bus ;
253255 u32 cfg_control ;
254256 u32 reg ;
255- struct resource * bus = resource_list_first_type (& pp -> bridge -> windows , IORESOURCE_BUS )-> res ;
256257
258+ ft = resource_list_first_type (& pp -> bridge -> windows , IORESOURCE_BUS );
259+ if (!ft )
260+ return - ENODEV ;
261+
262+ bus = ft -> res ;
257263 target_bus_cfg = & pcie -> target_bus_cfg ;
258264
259265 ecam_bus_mask = (pcie -> ecam_size >> PCIE_ECAM_BUS_SHIFT ) - 1 ;
@@ -287,6 +293,8 @@ static void al_pcie_config_prepare(struct al_pcie *pcie)
287293 FIELD_PREP (CFG_CONTROL_SEC_BUS_MASK , secondary_bus );
288294
289295 al_pcie_controller_writel (pcie , cfg_control_offset , reg );
296+
297+ return 0 ;
290298}
291299
292300static int al_pcie_host_init (struct dw_pcie_rp * pp )
@@ -305,7 +313,9 @@ static int al_pcie_host_init(struct dw_pcie_rp *pp)
305313 if (rc )
306314 return rc ;
307315
308- al_pcie_config_prepare (pcie );
316+ rc = al_pcie_config_prepare (pcie );
317+ if (rc )
318+ return rc ;
309319
310320 return 0 ;
311321}
You can’t perform that action at this time.
0 commit comments