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

Commit e9d2104c authored by Chandan Kumar Jha's avatar Chandan Kumar Jha Committed by Gerrit - the friendly Code Review server
Browse files

msm: camera: lrme: Change list iterator api during requests deletion



list_for_each_entry will break if we delete something while iterating
the list. it may result in an infinite loop and make CPU busy for
a longer time.

This change prevents to enter such condition.

Change-Id: I9d9ebdd9b2e00832e3493d73de4ba2ea3745a630
Signed-off-by: default avatarChandan Kumar Jha <cjha@codeaurora.org>
parent 28b5c65d
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -727,6 +727,7 @@ static int cam_lrme_mgr_hw_flush(void *hw_mgr_priv, void *hw_flush_args)
	struct cam_hw_flush_args *args;
	struct cam_lrme_device *hw_device;
	struct cam_lrme_frame_request *frame_req = NULL, *req_to_flush = NULL;
	struct cam_lrme_frame_request *frame_req_temp = NULL;
	struct cam_lrme_frame_request **req_list = NULL;
	uint32_t device_index;
	struct cam_lrme_hw_flush_args lrme_flush_args;
@@ -752,15 +753,15 @@ static int cam_lrme_mgr_hw_flush(void *hw_mgr_priv, void *hw_flush_args)
	}

	spin_lock(&hw_device->high_req_lock);
	list_for_each_entry(frame_req, &hw_device->frame_pending_list_high,
		frame_list) {
	list_for_each_entry_safe(frame_req, frame_req_temp,
		&hw_device->frame_pending_list_high, frame_list) {
		list_del_init(&frame_req->frame_list);
	}
	spin_unlock(&hw_device->high_req_lock);

	spin_lock(&hw_device->normal_req_lock);
	list_for_each_entry(frame_req, &hw_device->frame_pending_list_normal,
		frame_list) {
	list_for_each_entry_safe(frame_req, frame_req_temp,
		&hw_device->frame_pending_list_normal, frame_list) {
		list_del_init(&frame_req->frame_list);
	}
	spin_unlock(&hw_device->normal_req_lock);