]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
iommu: Make iommu_bus_notifier return NOTIFY_DONE rather than error code
authorzhichang.yuan <yuanzhichang@hisilicon.com>
Tue, 18 Apr 2017 12:51:48 +0000 (20:51 +0800)
committerJoerg Roedel <jroedel@suse.de>
Thu, 20 Apr 2017 14:42:52 +0000 (16:42 +0200)
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>
drivers/iommu/iommu.c

index 8ea14f41a979fd4e72e3a6093e5fa8d2a0eff24a..9170fd498f460fb52f147b3c1076e1721eb026b5 100644 (file)
@@ -1082,8 +1082,12 @@ static int iommu_bus_notifier(struct notifier_block *nb,
         * result in ADD/DEL notifiers to group->notifier
         */
        if (action == BUS_NOTIFY_ADD_DEVICE) {
-               if (ops->add_device)
-                       return ops->add_device(dev);
+               if (ops->add_device) {
+                       int ret;
+
+                       ret = ops->add_device(dev);
+                       return (ret) ? NOTIFY_DONE : NOTIFY_OK;
+               }
        } else if (action == BUS_NOTIFY_REMOVED_DEVICE) {
                if (ops->remove_device && dev->iommu_group) {
                        ops->remove_device(dev);