@@ -211,8 +211,8 @@ static struct sync_file *sync_file_merge(const char *name, struct sync_file *a,
211
211
struct sync_file * b )
212
212
{
213
213
struct sync_file * sync_file ;
214
- struct dma_fence * * fences , * * nfences , * * a_fences , * * b_fences ;
215
- int i , i_a , i_b , num_fences , a_num_fences , b_num_fences ;
214
+ struct dma_fence * * fences = NULL , * * nfences , * * a_fences , * * b_fences ;
215
+ int i = 0 , i_a , i_b , num_fences , a_num_fences , b_num_fences ;
216
216
217
217
sync_file = sync_file_alloc ();
218
218
if (!sync_file )
@@ -236,7 +236,7 @@ static struct sync_file *sync_file_merge(const char *name, struct sync_file *a,
236
236
* If a sync_file can only be created with sync_file_merge
237
237
* and sync_file_create, this is a reasonable assumption.
238
238
*/
239
- for (i = i_a = i_b = 0 ; i_a < a_num_fences && i_b < b_num_fences ; ) {
239
+ for (i_a = i_b = 0 ; i_a < a_num_fences && i_b < b_num_fences ; ) {
240
240
struct dma_fence * pt_a = a_fences [i_a ];
241
241
struct dma_fence * pt_b = b_fences [i_b ];
242
242
@@ -277,15 +277,16 @@ static struct sync_file *sync_file_merge(const char *name, struct sync_file *a,
277
277
fences = nfences ;
278
278
}
279
279
280
- if (sync_file_set_fence (sync_file , fences , i ) < 0 ) {
281
- kfree (fences );
280
+ if (sync_file_set_fence (sync_file , fences , i ) < 0 )
282
281
goto err ;
283
- }
284
282
285
283
strlcpy (sync_file -> user_name , name , sizeof (sync_file -> user_name ));
286
284
return sync_file ;
287
285
288
286
err :
287
+ while (i )
288
+ dma_fence_put (fences [-- i ]);
289
+ kfree (fences );
289
290
fput (sync_file -> file );
290
291
return NULL ;
291
292
0 commit comments