@@ -96,8 +96,7 @@ int of_dma_configure_id(struct device *dev, struct device_node *np,
96
96
const struct bus_dma_region * map = NULL ;
97
97
struct device_node * bus_np ;
98
98
u64 mask , end = 0 ;
99
- bool coherent ;
100
- int iommu_ret ;
99
+ bool coherent , set_map = false;
101
100
int ret ;
102
101
103
102
if (np == dev -> of_node )
@@ -118,6 +117,7 @@ int of_dma_configure_id(struct device *dev, struct device_node *np,
118
117
} else {
119
118
/* Determine the overall bounds of all DMA regions */
120
119
end = dma_range_map_max (map );
120
+ set_map = true;
121
121
}
122
122
123
123
/*
@@ -144,7 +144,7 @@ int of_dma_configure_id(struct device *dev, struct device_node *np,
144
144
dev -> coherent_dma_mask &= mask ;
145
145
* dev -> dma_mask &= mask ;
146
146
/* ...but only set bus limit and range map if we found valid dma-ranges earlier */
147
- if (! ret ) {
147
+ if (set_map ) {
148
148
dev -> bus_dma_limit = end ;
149
149
dev -> dma_range_map = map ;
150
150
}
@@ -153,29 +153,21 @@ int of_dma_configure_id(struct device *dev, struct device_node *np,
153
153
dev_dbg (dev , "device is%sdma coherent\n" ,
154
154
coherent ? " " : " not " );
155
155
156
- iommu_ret = of_iommu_configure (dev , np , id );
157
- if (iommu_ret == - EPROBE_DEFER ) {
156
+ ret = of_iommu_configure (dev , np , id );
157
+ if (ret == - EPROBE_DEFER ) {
158
158
/* Don't touch range map if it wasn't set from a valid dma-ranges */
159
- if (! ret )
159
+ if (set_map )
160
160
dev -> dma_range_map = NULL ;
161
161
kfree (map );
162
162
return - EPROBE_DEFER ;
163
- } else if (iommu_ret == - ENODEV ) {
164
- dev_dbg (dev , "device is not behind an iommu\n" );
165
- } else if (iommu_ret ) {
166
- dev_err (dev , "iommu configuration for device failed with %pe\n" ,
167
- ERR_PTR (iommu_ret ));
168
-
169
- /*
170
- * Historically this routine doesn't fail driver probing
171
- * due to errors in of_iommu_configure()
172
- */
173
- } else
174
- dev_dbg (dev , "device is behind an iommu\n" );
163
+ }
164
+ /* Take all other IOMMU errors to mean we'll just carry on without it */
165
+ dev_dbg (dev , "device is%sbehind an iommu\n" ,
166
+ !ret ? " " : " not " );
175
167
176
168
arch_setup_dma_ops (dev , coherent );
177
169
178
- if (iommu_ret )
170
+ if (ret )
179
171
of_dma_set_restricted_buffer (dev , np );
180
172
181
173
return 0 ;
0 commit comments