Commit 8902e87f authored by John Rose's avatar John Rose Committed by Paul Mackerras

[PATCH] ppc64: Fix add notifier crashes

The extraction of PCI stuff from struct device_node left some false
assumptions in notifier code.  As a result, dynamic add crashes when
non-PCI nodes are added.  This patch fixes these assumptions.
Signed-off-by: default avatarJohn Rose <johnrose@austin.ibm.com>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent f4fcbbe9
...@@ -498,7 +498,7 @@ static int iommu_reconfig_notifier(struct notifier_block *nb, unsigned long acti ...@@ -498,7 +498,7 @@ static int iommu_reconfig_notifier(struct notifier_block *nb, unsigned long acti
switch (action) { switch (action) {
case PSERIES_RECONFIG_REMOVE: case PSERIES_RECONFIG_REMOVE:
if (pci->iommu_table && if (pci && pci->iommu_table &&
get_property(np, "ibm,dma-window", NULL)) get_property(np, "ibm,dma-window", NULL))
iommu_free_table(np); iommu_free_table(np);
break; break;
......
...@@ -181,13 +181,14 @@ EXPORT_SYMBOL(fetch_dev_dn); ...@@ -181,13 +181,14 @@ EXPORT_SYMBOL(fetch_dev_dn);
static int pci_dn_reconfig_notifier(struct notifier_block *nb, unsigned long action, void *node) static int pci_dn_reconfig_notifier(struct notifier_block *nb, unsigned long action, void *node)
{ {
struct device_node *np = node; struct device_node *np = node;
struct pci_dn *pci; struct pci_dn *pci = NULL;
int err = NOTIFY_OK; int err = NOTIFY_OK;
switch (action) { switch (action) {
case PSERIES_RECONFIG_ADD: case PSERIES_RECONFIG_ADD:
pci = np->parent->data; pci = np->parent->data;
update_dn_pci_info(np, pci->phb); if (pci)
update_dn_pci_info(np, pci->phb);
break; break;
default: default:
err = NOTIFY_DONE; err = NOTIFY_DONE;
......
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