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

Commit 4afdaa0b authored by Sunid Wilson's avatar Sunid Wilson Committed by Gerrit - the friendly Code Review server
Browse files

msm: jpeg: Make _msm_jpeg_open and _msm_jpeg_release atomic



The jpeg open and release functions are not atomic and can cause
race conditions. Make open and release atomic.

Change-Id: I933ee039d4c01616008fa4b286322d9b679004b2
Signed-off-by: default avatarSunid Wilson <sunidw@codeaurora.org>
parent ec1d8c52
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -722,8 +722,6 @@ int __msm_jpeg_open(struct msm_jpeg_device *pgmn_dev)
	if (pgmn_dev->open_count == 1)
		pgmn_dev->state = MSM_JPEG_INIT;

	mutex_unlock(&pgmn_dev->lock);

	msm_jpeg_core_irq_install(msm_jpeg_irq);
	if (pgmn_dev->core_type == MSM_JPEG_CORE_CODEC)
		core_irq = msm_jpeg_core_irq;
@@ -736,6 +734,7 @@ int __msm_jpeg_open(struct msm_jpeg_device *pgmn_dev)
	if (rc) {
		JPEG_PR_ERR("%s:%d] platform_init fail %d\n", __func__,
			__LINE__, rc);
		mutex_unlock(&pgmn_dev->lock);
		return rc;
	}

@@ -753,6 +752,7 @@ int __msm_jpeg_open(struct msm_jpeg_device *pgmn_dev)
	msm_jpeg_core_init(pgmn_dev);

	JPEG_DBG("%s:%d] success\n", __func__, __LINE__);
	mutex_unlock(&pgmn_dev->lock);
	return rc;
}

@@ -766,7 +766,6 @@ int __msm_jpeg_release(struct msm_jpeg_device *pgmn_dev)
		return -EINVAL;
	}
	pgmn_dev->open_count--;
	mutex_unlock(&pgmn_dev->lock);

	msm_jpeg_core_release(pgmn_dev, pgmn_dev->domain_num);
	msm_jpeg_q_cleanup(&pgmn_dev->evt_q);
@@ -785,6 +784,7 @@ int __msm_jpeg_release(struct msm_jpeg_device *pgmn_dev)
		pgmn_dev->irq, pgmn_dev);

	JPEG_DBG("%s:%d]\n", __func__, __LINE__);
	mutex_unlock(&pgmn_dev->lock);
	return 0;
}