diff options
author | zhichang.yuan <yuanzhichang@hisilicon.com> | 2017-04-18 08:51:48 -0400 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2017-04-20 10:42:52 -0400 |
commit | 3ba8775f64484a2b56bf3c88d09a186d819fa348 (patch) | |
tree | 4671e5427599947ad4f4104656167a36800ea1e7 | |
parent | b4d8c7aea15efa8c6272c58d78296f8b017c4c6a (diff) |
iommu: Make iommu_bus_notifier return NOTIFY_DONE rather than error code
In iommu_bus_notifier(), when action is
BUS_NOTIFY_ADD_DEVICE, it will return 'ops->add_device(dev)'
directly. But ops->add_device will return ERR_VAL, such as
-ENODEV. These value will make notifier_call_chain() not to
traverse the remain nodes in struct notifier_block list.
This patch revises iommu_bus_notifier() to return
NOTIFY_DONE when some errors happened in ops->add_device().
Signed-off-by: zhichang.yuan <yuanzhichang@hisilicon.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
-rw-r--r-- | drivers/iommu/iommu.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 8ea14f41a979..9170fd498f46 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c | |||
@@ -1082,8 +1082,12 @@ static int iommu_bus_notifier(struct notifier_block *nb, | |||
1082 | * result in ADD/DEL notifiers to group->notifier | 1082 | * result in ADD/DEL notifiers to group->notifier |
1083 | */ | 1083 | */ |
1084 | if (action == BUS_NOTIFY_ADD_DEVICE) { | 1084 | if (action == BUS_NOTIFY_ADD_DEVICE) { |
1085 | if (ops->add_device) | 1085 | if (ops->add_device) { |
1086 | return ops->add_device(dev); | 1086 | int ret; |
1087 | |||
1088 | ret = ops->add_device(dev); | ||
1089 | return (ret) ? NOTIFY_DONE : NOTIFY_OK; | ||
1090 | } | ||
1087 | } else if (action == BUS_NOTIFY_REMOVED_DEVICE) { | 1091 | } else if (action == BUS_NOTIFY_REMOVED_DEVICE) { |
1088 | if (ops->remove_device && dev->iommu_group) { | 1092 | if (ops->remove_device && dev->iommu_group) { |
1089 | ops->remove_device(dev); | 1093 | ops->remove_device(dev); |