浏览代码

iommu/amd: Check for error states first in iommu_go_to_state()

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

Signed-off-by: Joerg Roedel <jroedel@suse.de>
Joerg Roedel 8 年之前
父节点
当前提交
151b09031a
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      drivers/iommu/amd_iommu_init.c

+ 2 - 2
drivers/iommu/amd_iommu_init.c

@@ -2467,14 +2467,14 @@ static int __init state_next(void)
 
 
 static int __init iommu_go_to_state(enum iommu_init_state state)
 static int __init iommu_go_to_state(enum iommu_init_state state)
 {
 {
-	int ret = 0;
+	int ret = -EINVAL;
 
 
 	while (init_state != state) {
 	while (init_state != state) {
-		ret = state_next();
 		if (init_state == IOMMU_NOT_FOUND         ||
 		if (init_state == IOMMU_NOT_FOUND         ||
 		    init_state == IOMMU_INIT_ERROR        ||
 		    init_state == IOMMU_INIT_ERROR        ||
 		    init_state == IOMMU_CMDLINE_DISABLED)
 		    init_state == IOMMU_CMDLINE_DISABLED)
 			break;
 			break;
+		ret = state_next();
 	}
 	}
 
 
 	return ret;
 	return ret;