mirror of
https://git.proxmox.com/git/mirror_ubuntu-kernels.git
synced 2025-12-09 15:06:01 +00:00
Merge branch 'pci/controller/al'
- Check IORESOURCE_BUS existence to avoid NULL pointer dereference (Aleksandr Mishin) * pci/controller/al: PCI: al: Check IORESOURCE_BUS existence during probe
This commit is contained in:
commit
e38de94edd
@ -242,18 +242,24 @@ static struct pci_ops al_child_pci_ops = {
|
|||||||
.write = pci_generic_config_write,
|
.write = pci_generic_config_write,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void al_pcie_config_prepare(struct al_pcie *pcie)
|
static int al_pcie_config_prepare(struct al_pcie *pcie)
|
||||||
{
|
{
|
||||||
struct al_pcie_target_bus_cfg *target_bus_cfg;
|
struct al_pcie_target_bus_cfg *target_bus_cfg;
|
||||||
struct dw_pcie_rp *pp = &pcie->pci->pp;
|
struct dw_pcie_rp *pp = &pcie->pci->pp;
|
||||||
unsigned int ecam_bus_mask;
|
unsigned int ecam_bus_mask;
|
||||||
|
struct resource_entry *ft;
|
||||||
u32 cfg_control_offset;
|
u32 cfg_control_offset;
|
||||||
|
struct resource *bus;
|
||||||
u8 subordinate_bus;
|
u8 subordinate_bus;
|
||||||
u8 secondary_bus;
|
u8 secondary_bus;
|
||||||
u32 cfg_control;
|
u32 cfg_control;
|
||||||
u32 reg;
|
u32 reg;
|
||||||
struct resource *bus = resource_list_first_type(&pp->bridge->windows, IORESOURCE_BUS)->res;
|
|
||||||
|
|
||||||
|
ft = resource_list_first_type(&pp->bridge->windows, IORESOURCE_BUS);
|
||||||
|
if (!ft)
|
||||||
|
return -ENODEV;
|
||||||
|
|
||||||
|
bus = ft->res;
|
||||||
target_bus_cfg = &pcie->target_bus_cfg;
|
target_bus_cfg = &pcie->target_bus_cfg;
|
||||||
|
|
||||||
ecam_bus_mask = (pcie->ecam_size >> PCIE_ECAM_BUS_SHIFT) - 1;
|
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)
|
|||||||
FIELD_PREP(CFG_CONTROL_SEC_BUS_MASK, secondary_bus);
|
FIELD_PREP(CFG_CONTROL_SEC_BUS_MASK, secondary_bus);
|
||||||
|
|
||||||
al_pcie_controller_writel(pcie, cfg_control_offset, reg);
|
al_pcie_controller_writel(pcie, cfg_control_offset, reg);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int al_pcie_host_init(struct dw_pcie_rp *pp)
|
static 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)
|
|||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
al_pcie_config_prepare(pcie);
|
rc = al_pcie_config_prepare(pcie);
|
||||||
|
if (rc)
|
||||||
|
return rc;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user