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

Commit f788b131 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: vidc: Fix a race condition in core instances list access"

parents cb544cb0 eaa215c2
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -775,6 +775,7 @@ static void handle_sys_error(enum command_response cmd, void *data)
			mutex_lock(&core->lock);
			core->state = VIDC_CORE_INVALID;
			mutex_unlock(&core->lock);
			mutex_lock(&core->sync_lock);
			list_for_each_entry(inst, &core->instances,
					list) {
				mutex_lock(&inst->lock);
@@ -796,6 +797,7 @@ static void handle_sys_error(enum command_response cmd, void *data)
				msm_vidc_queue_v4l2_event(inst,
						V4L2_EVENT_MSM_VIDC_SYS_ERROR);
			}
			mutex_unlock(&core->sync_lock);
		} else {
			dprintk(VIDC_ERR,
				"Got SYS_ERR but unable to identify core");
@@ -823,6 +825,7 @@ static void handle_sys_watchdog_timeout(enum command_response cmd, void *data)
	mutex_lock(&core->lock);
	core->state = VIDC_CORE_INVALID;
	mutex_unlock(&core->lock);
	mutex_lock(&core->sync_lock);
	list_for_each_entry(inst, &core->instances, list) {
		if (inst) {
			msm_vidc_queue_v4l2_event(inst,
@@ -844,6 +847,7 @@ static void handle_sys_watchdog_timeout(enum command_response cmd, void *data)
			mutex_unlock(&inst->lock);
		}
	}
	mutex_unlock(&core->sync_lock);
}

static void handle_session_close(enum command_response cmd, void *data)
@@ -3244,10 +3248,12 @@ static int msm_vidc_load_supported(struct msm_vidc_inst *inst)
	int num_mbs_per_sec = 0;

	if (inst->state == MSM_VIDC_OPEN_DONE) {
		mutex_lock(&inst->core->sync_lock);
		num_mbs_per_sec = msm_comm_get_load(inst->core,
					MSM_VIDC_DECODER);
		num_mbs_per_sec += msm_comm_get_load(inst->core,
					MSM_VIDC_ENCODER);
		mutex_unlock(&inst->core->sync_lock);
		if (num_mbs_per_sec > inst->core->resources.max_load) {
			dprintk(VIDC_ERR,
				"H/w is overloaded. needed: %d max: %d\n",