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

Commit cc093476 authored by Arun Menon's avatar Arun Menon
Browse files

msm: vidc: initialize venus hfi locks during hfi creation



Venus hfi locks were initialized during core init,
which is invoked when the first video instance is
created. If a debugfs command is executed before
starting the first video instance, then video driver
crashes trying to lock an uninitialized mutex.

Change-Id: I472e9de91dada94a2728dd02c747e7fde63e3e4f
Signed-off-by: default avatarArun Menon <avmenon@codeaurora.org>
parent 9927ec3d
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -1707,9 +1707,6 @@ static int venus_hfi_core_init(void *device)

	dev->intr_status = 0;
	INIT_LIST_HEAD(&dev->sess_head);
	mutex_init(&dev->read_lock);
	mutex_init(&dev->write_lock);
	mutex_init(&dev->session_lock);
	venus_hfi_set_registers(dev);

	if (!dev->hal_client) {
@@ -3535,7 +3532,6 @@ static int venus_hfi_load_fw(void *dev)
		return -EINVAL;
	}

	mutex_init(&device->clk_pwr_lock);
	rc = venus_hfi_iommu_attach(device);
	if (rc) {
		dprintk(VIDC_ERR, "Failed to attach iommu\n");
@@ -3767,6 +3763,11 @@ static void *venus_hfi_add_device(u32 device_id,
		goto error_createq_pm;
	}

	mutex_init(&hdevice->read_lock);
	mutex_init(&hdevice->write_lock);
	mutex_init(&hdevice->session_lock);
	mutex_init(&hdevice->clk_pwr_lock);

	if (hal_ctxt.dev_count == 0)
		INIT_LIST_HEAD(&hal_ctxt.dev_head);