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

Commit 84f8c42e authored by Trishansh Bhardwaj's avatar Trishansh Bhardwaj
Browse files

msm: camera: Allow driver file to be opend only once.



Use proper synchronization to ensure driver file is opened
only once.

CRs-Fixed: 2023513
Change-Id: I71e55e2d487fe561d3f596590b3e8102c5e921b5
Signed-off-by: default avatarTrishansh Bhardwaj <tbhardwa@codeaurora.org>
parent 6319cf03
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -1012,11 +1012,9 @@ static int msm_open(struct file *filep)
	BUG_ON(!pvdev);

	/* !!! only ONE open is allowed !!! */
	if (atomic_read(&pvdev->opened))
	if (atomic_cmpxchg(&pvdev->opened, 0, 1))
		return -EBUSY;

	atomic_set(&pvdev->opened, 1);

	spin_lock_irqsave(&msm_pid_lock, flags);
	msm_pid = get_pid(task_pid(current));
	spin_unlock_irqrestore(&msm_pid_lock, flags);