Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3ed44035 authored by Junzhe Zou's avatar Junzhe Zou
Browse files

msm: camera: fd: put back the frame resource properly



Put the frame request back properly during flush to avoid resource
leak.

Change-Id: I3f7bcc17d866f5d9416549eed12e8dbadce3b403
Signed-off-by: default avatarJunzhe Zou <jnzhezou@codeaurora.org>
parent 0a902be3
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -162,8 +162,10 @@ static int cam_fd_mgr_util_put_frame_req(

	mutex_lock(&g_fd_hw_mgr.frame_req_mutex);
	req_ptr = *frame_req;
	if (req_ptr)
	if (req_ptr) {
		list_del_init(&req_ptr->list);
		list_add_tail(&req_ptr->list, src_list);
	}
	*frame_req = NULL;
	mutex_unlock(&g_fd_hw_mgr.frame_req_mutex);

@@ -1465,6 +1467,16 @@ static int cam_fd_mgr_hw_flush_ctx(void *hw_mgr_priv,
	for (i = 0; i < flush_args->num_req_pending; i++) {
		flush_req = (struct cam_fd_mgr_frame_request *)
			flush_args->flush_req_pending[i];
		CAM_DBG(CAM_FD, "flush pending req %llu",
			flush_req->request_id);
		cam_fd_mgr_util_put_frame_req(&hw_mgr->frame_free_list,
			&flush_req);
	}

	for (i = 0; i < flush_args->num_req_active; i++) {
		flush_req = (struct cam_fd_mgr_frame_request *)
			flush_args->flush_req_active[i];
		CAM_DBG(CAM_FD, "flush active req %llu", flush_req->request_id);
		cam_fd_mgr_util_put_frame_req(&hw_mgr->frame_free_list,
			&flush_req);
	}