@@ -105,6 +105,7 @@ static unsigned int pin_job(struct host1x *host, struct host1x_job *job)
105
105
{
106
106
struct host1x_client * client = job -> client ;
107
107
struct device * dev = client -> dev ;
108
+ struct host1x_job_gather * g ;
108
109
struct iommu_domain * domain ;
109
110
unsigned int i ;
110
111
int err ;
@@ -194,7 +195,6 @@ static unsigned int pin_job(struct host1x *host, struct host1x_job *job)
194
195
return 0 ;
195
196
196
197
for (i = 0 ; i < job -> num_gathers ; i ++ ) {
197
- struct host1x_job_gather * g = & job -> gathers [i ];
198
198
size_t gather_size = 0 ;
199
199
struct scatterlist * sg ;
200
200
struct sg_table * sgt ;
@@ -204,6 +204,7 @@ static unsigned int pin_job(struct host1x *host, struct host1x_job *job)
204
204
dma_addr_t * phys ;
205
205
unsigned int j ;
206
206
207
+ g = & job -> gathers [i ];
207
208
g -> bo = host1x_bo_get (g -> bo );
208
209
if (!g -> bo ) {
209
210
err = - EINVAL ;
@@ -223,7 +224,7 @@ static unsigned int pin_job(struct host1x *host, struct host1x_job *job)
223
224
sgt = host1x_bo_pin (host -> dev , g -> bo , phys );
224
225
if (IS_ERR (sgt )) {
225
226
err = PTR_ERR (sgt );
226
- goto unpin ;
227
+ goto put ;
227
228
}
228
229
229
230
if (host -> domain ) {
@@ -236,7 +237,7 @@ static unsigned int pin_job(struct host1x *host, struct host1x_job *job)
236
237
host -> iova_end >> shift , true);
237
238
if (!alloc ) {
238
239
err = - ENOMEM ;
239
- goto unpin ;
240
+ goto put ;
240
241
}
241
242
242
243
err = iommu_map_sg (host -> domain ,
@@ -245,7 +246,7 @@ static unsigned int pin_job(struct host1x *host, struct host1x_job *job)
245
246
if (err == 0 ) {
246
247
__free_iova (& host -> iova , alloc );
247
248
err = - EINVAL ;
248
- goto unpin ;
249
+ goto put ;
249
250
}
250
251
251
252
job -> unpins [job -> num_unpins ].size = gather_size ;
@@ -255,7 +256,7 @@ static unsigned int pin_job(struct host1x *host, struct host1x_job *job)
255
256
DMA_TO_DEVICE );
256
257
if (!err ) {
257
258
err = - ENOMEM ;
258
- goto unpin ;
259
+ goto put ;
259
260
}
260
261
261
262
job -> unpins [job -> num_unpins ].dir = DMA_TO_DEVICE ;
@@ -273,6 +274,8 @@ static unsigned int pin_job(struct host1x *host, struct host1x_job *job)
273
274
274
275
return 0 ;
275
276
277
+ put :
278
+ host1x_bo_put (g -> bo );
276
279
unpin :
277
280
host1x_job_unpin (job );
278
281
return err ;
0 commit comments