diff options
Diffstat (limited to 'drivers/dma-buf/sync_file.c')
-rw-r--r-- | drivers/dma-buf/sync_file.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/drivers/dma-buf/sync_file.c b/drivers/dma-buf/sync_file.c index 2321035f6204..dc89b1d484e8 100644 --- a/drivers/dma-buf/sync_file.c +++ b/drivers/dma-buf/sync_file.c | |||
@@ -41,8 +41,6 @@ static struct sync_file *sync_file_alloc(void) | |||
41 | if (IS_ERR(sync_file->file)) | 41 | if (IS_ERR(sync_file->file)) |
42 | goto err; | 42 | goto err; |
43 | 43 | ||
44 | kref_init(&sync_file->kref); | ||
45 | |||
46 | init_waitqueue_head(&sync_file->wq); | 44 | init_waitqueue_head(&sync_file->wq); |
47 | 45 | ||
48 | INIT_LIST_HEAD(&sync_file->cb.node); | 46 | INIT_LIST_HEAD(&sync_file->cb.node); |
@@ -277,22 +275,15 @@ err: | |||
277 | 275 | ||
278 | } | 276 | } |
279 | 277 | ||
280 | static void sync_file_free(struct kref *kref) | 278 | static int sync_file_release(struct inode *inode, struct file *file) |
281 | { | 279 | { |
282 | struct sync_file *sync_file = container_of(kref, struct sync_file, | 280 | struct sync_file *sync_file = file->private_data; |
283 | kref); | ||
284 | 281 | ||
285 | if (test_bit(POLL_ENABLED, &sync_file->fence->flags)) | 282 | if (test_bit(POLL_ENABLED, &sync_file->fence->flags)) |
286 | dma_fence_remove_callback(sync_file->fence, &sync_file->cb); | 283 | dma_fence_remove_callback(sync_file->fence, &sync_file->cb); |
287 | dma_fence_put(sync_file->fence); | 284 | dma_fence_put(sync_file->fence); |
288 | kfree(sync_file); | 285 | kfree(sync_file); |
289 | } | ||
290 | |||
291 | static int sync_file_release(struct inode *inode, struct file *file) | ||
292 | { | ||
293 | struct sync_file *sync_file = file->private_data; | ||
294 | 286 | ||
295 | kref_put(&sync_file->kref, sync_file_free); | ||
296 | return 0; | 287 | return 0; |
297 | } | 288 | } |
298 | 289 | ||