Commit 82eae1af authored by Alexey Kardashevskiy's avatar Alexey Kardashevskiy Committed by Michael Ellerman

powerpc/powernv: Check kzalloc() return value in pnv_pci_table_alloc

pnv_pci_table_alloc() ignores possible failure from kzalloc_node(),
this adds a check. There are 2 callers of pnv_pci_table_alloc(),
one already checks for tbl!=NULL, this adds WARN_ON() to the other path
which only happens during boot time in IODA1 and not expected to fail.
Signed-off-by: default avatarAlexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent b71c9ffb
...@@ -2151,6 +2151,9 @@ static void pnv_pci_ioda1_setup_dma_pe(struct pnv_phb *phb, ...@@ -2151,6 +2151,9 @@ static void pnv_pci_ioda1_setup_dma_pe(struct pnv_phb *phb,
found: found:
tbl = pnv_pci_table_alloc(phb->hose->node); tbl = pnv_pci_table_alloc(phb->hose->node);
if (WARN_ON(!tbl))
return;
iommu_register_group(&pe->table_group, phb->hose->global_number, iommu_register_group(&pe->table_group, phb->hose->global_number,
pe->pe_number); pe->pe_number);
pnv_pci_link_table_and_group(phb->hose->node, 0, tbl, &pe->table_group); pnv_pci_link_table_and_group(phb->hose->node, 0, tbl, &pe->table_group);
......
...@@ -766,6 +766,9 @@ struct iommu_table *pnv_pci_table_alloc(int nid) ...@@ -766,6 +766,9 @@ struct iommu_table *pnv_pci_table_alloc(int nid)
struct iommu_table *tbl; struct iommu_table *tbl;
tbl = kzalloc_node(sizeof(struct iommu_table), GFP_KERNEL, nid); tbl = kzalloc_node(sizeof(struct iommu_table), GFP_KERNEL, nid);
if (!tbl)
return NULL;
INIT_LIST_HEAD_RCU(&tbl->it_group_list); INIT_LIST_HEAD_RCU(&tbl->it_group_list);
kref_init(&tbl->it_kref); kref_init(&tbl->it_kref);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment