Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1625294 > unrolled thread

[PATCH] iommu: make iommu_bus_notifier return NOTIFY_DONE rather than error code

Started by"zhichang.yuan" <yuanzhichang@hisilicon.com>
First post2017-04-18 14:30 +0200
Last post2017-04-20 16:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] iommu: make iommu_bus_notifier return NOTIFY_DONE rather than  error code "zhichang.yuan" <yuanzhichang@hisilicon.com> - 2017-04-18 14:30 +0200
    Re: [PATCH] iommu: make iommu_bus_notifier return NOTIFY_DONE rather  than  error code Joerg Roedel <joro@8bytes.org> - 2017-04-20 16:50 +0200

#1625294 — [PATCH] iommu: make iommu_bus_notifier return NOTIFY_DONE rather than error code

From"zhichang.yuan" <yuanzhichang@hisilicon.com>
Date2017-04-18 14:30 +0200
Subject[PATCH] iommu: make iommu_bus_notifier return NOTIFY_DONE rather than error code
Message-ID<txAqB-67T-3@gated-at.bofh.it>
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
heppened in ops->add_device().

Signed-off-by: zhichang.yuan <yuanzhichang@hisilicon.com>
---
 drivers/iommu/iommu.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 3b67144..2d32911 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -1083,8 +1083,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);
-- 
1.9.1

[toc] | [next] | [standalone]


#1627553 — Re: [PATCH] iommu: make iommu_bus_notifier return NOTIFY_DONE rather than error code

FromJoerg Roedel <joro@8bytes.org>
Date2017-04-20 16:50 +0200
SubjectRe: [PATCH] iommu: make iommu_bus_notifier return NOTIFY_DONE rather than error code
Message-ID<tylzc-1JN-13@gated-at.bofh.it>
In reply to#1625294
On Tue, Apr 18, 2017 at 08:51:48PM +0800, zhichang.yuan wrote:
> 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
> heppened in ops->add_device().
> 
> Signed-off-by: zhichang.yuan <yuanzhichang@hisilicon.com>

Applied, thanks.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web