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


Groups > linux.kernel > #1667781

[PATCH 4/7] iommu/amd: Check for error states first in iommu_go_to_state()

From Joerg Roedel <joro@8bytes.org>
Newsgroups linux.kernel
Subject [PATCH 4/7] iommu/amd: Check for error states first in iommu_go_to_state()
Date 2017-06-16 16:20 +0200
Message-ID <tT0gq-1a4-11@gated-at.bofh.it> (permalink)
References <tT0gp-1a4-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Joerg Roedel <jroedel@suse.de>

Check if we are in an error state already before calling
into state_next().

Signed-off-by: Joerg Roedel <jroedel@suse.de>
---
 drivers/iommu/amd_iommu_init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index c40adc8..a31f375 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -2465,14 +2465,14 @@ static int __init state_next(void)
 
 static int __init iommu_go_to_state(enum iommu_init_state state)
 {
-	int ret = 0;
+	int ret = -EINVAL;
 
 	while (init_state != state) {
-		ret = state_next();
 		if (init_state == IOMMU_NOT_FOUND         ||
 		    init_state == IOMMU_INIT_ERROR        ||
 		    init_state == IOMMU_CMDLINE_DISABLED)
 			break;
+		ret = state_next();
 	}
 
 	return ret;
-- 
2.7.4

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH 4/7] iommu/amd: Check for error states first in iommu_go_to_state() Joerg Roedel <joro@8bytes.org> - 2017-06-16 16:20 +0200

csiph-web