diff --git a/drivers/gpu/host1x-fence/dev.c b/drivers/gpu/host1x-fence/dev.c index 01c83f57..a6988b0f 100644 --- a/drivers/gpu/host1x-fence/dev.c +++ b/drivers/gpu/host1x-fence/dev.c @@ -1,9 +1,5 @@ // SPDX-License-Identifier: GPL-2.0-only -/* - * Host1x fence UAPI - * - * Copyright (c) 2022-2024, NVIDIA CORPORATION. All rights reserved. - */ +// SPDX-FileCopyrightText: Copyright (c) 2022-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. #include @@ -205,20 +201,23 @@ struct host1x_pollfd { static int host1x_pollfd_release(struct inode *inode, struct file *file) { struct host1x_pollfd *pollfd = file->private_data; - struct host1x_pollfd_fence *pfd_fence; + struct host1x_pollfd_fence *pfd_fence, *pfd_fence_temp; mutex_lock(&pollfd->lock); - list_for_each_entry(pfd_fence, &pollfd->fences, list) { + list_for_each_entry_safe(pfd_fence, pfd_fence_temp, &pollfd->fences, list) { if (pfd_fence->callback_set) { if (dma_fence_remove_callback(pfd_fence->fence, &pfd_fence->callback)) host1x_fence_cancel(pfd_fence->fence); } dma_fence_put(pfd_fence->fence); + kfree(pfd_fence); } mutex_unlock(&pollfd->lock); + kfree(pollfd); + return 0; } @@ -237,6 +236,7 @@ static unsigned int host1x_pollfd_poll(struct file *file, poll_table *wait) mask = POLLPRI | POLLIN; dma_fence_put(pfd_fence->fence); list_del(&pfd_fence->list); + kfree(pfd_fence); } }