File tree Expand file tree Collapse file tree 1 file changed +7
-12
lines changed Expand file tree Collapse file tree 1 file changed +7
-12
lines changed Original file line number Diff line number Diff line change @@ -2046,12 +2046,6 @@ static int protection_domain_init_v1(struct protection_domain *domain, int mode)
2046
2046
2047
2047
BUG_ON (mode < PAGE_MODE_NONE || mode > PAGE_MODE_6_LEVEL );
2048
2048
2049
- spin_lock_init (& domain -> lock );
2050
- domain -> id = domain_id_alloc ();
2051
- if (!domain -> id )
2052
- return - ENOMEM ;
2053
- INIT_LIST_HEAD (& domain -> dev_list );
2054
-
2055
2049
if (mode != PAGE_MODE_NONE ) {
2056
2050
pt_root = (void * )get_zeroed_page (GFP_KERNEL );
2057
2051
if (!pt_root ) {
@@ -2067,12 +2061,6 @@ static int protection_domain_init_v1(struct protection_domain *domain, int mode)
2067
2061
2068
2062
static int protection_domain_init_v2 (struct protection_domain * domain )
2069
2063
{
2070
- spin_lock_init (& domain -> lock );
2071
- domain -> id = domain_id_alloc ();
2072
- if (!domain -> id )
2073
- return - ENOMEM ;
2074
- INIT_LIST_HEAD (& domain -> dev_list );
2075
-
2076
2064
domain -> flags |= PD_GIOV_MASK ;
2077
2065
2078
2066
domain -> domain .pgsize_bitmap = AMD_IOMMU_PGSIZES_V2 ;
@@ -2112,6 +2100,13 @@ static struct protection_domain *protection_domain_alloc(unsigned int type)
2112
2100
if (!domain )
2113
2101
return NULL ;
2114
2102
2103
+ domain -> id = domain_id_alloc ();
2104
+ if (!domain -> id )
2105
+ goto out_err ;
2106
+
2107
+ spin_lock_init (& domain -> lock );
2108
+ INIT_LIST_HEAD (& domain -> dev_list );
2109
+
2115
2110
switch (pgtable ) {
2116
2111
case AMD_IOMMU_V1 :
2117
2112
ret = protection_domain_init_v1 (domain , mode );
You can’t perform that action at this time.
0 commit comments