Skip to content

Commit 12e13ac

Browse files
Jan Beulichkonradwilk
authored andcommitted
xen/pci: make bus notifier handler return sane values
Notifier functions are expected to return NOTIFY_* codes, not -E... ones. In particular, since the respective hypercalls failing is not fatal to the operation of the Dom0 kernel, it must be avoided to return negative values here as those would make it appear as if NOTIFY_STOP_MASK wa set, suppressing further notification calls to other interested parties (which is also why we don't want to use notifier_from_errno() here). While at it, also notify the user of a failed hypercall. Signed-off-by: Jan Beulich <[email protected]> [v1: Added dev_err and the disable MSI/MSI-X call] [v2: Removed the disable MSI/MSI-X call] Signed-off-by: Konrad Rzeszutek Wilk <[email protected]>
1 parent 61ca798 commit 12e13ac

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

drivers/xen/pci.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,16 @@ static int xen_pci_notifier(struct notifier_block *nb,
9696
r = xen_remove_device(dev);
9797
break;
9898
default:
99-
break;
99+
return NOTIFY_DONE;
100100
}
101-
102-
return r;
101+
if (r)
102+
dev_err(dev, "Failed to %s - passthrough or MSI/MSI-X might fail!\n",
103+
action == BUS_NOTIFY_ADD_DEVICE ? "add" :
104+
(action == BUS_NOTIFY_DEL_DEVICE ? "delete" : "?"));
105+
return NOTIFY_OK;
103106
}
104107

105-
struct notifier_block device_nb = {
108+
static struct notifier_block device_nb = {
106109
.notifier_call = xen_pci_notifier,
107110
};
108111

0 commit comments

Comments
 (0)