Commit 9b8bb37d authored by Naveen Ramaraj's avatar Naveen Ramaraj Committed by Ed Tam

msm: smd_pkt: Avoid prematurely stashing driver info

smd_pkt_release() relies on checks that would pass by default
(reference count == 0) to proceed with the release even if the
open was unsuccessful in the first place

Bug: b/18759663
Signed-off-by: default avatarNaveen Ramaraj <nramaraj@codeaurora.org>
parent 558d16c2
......@@ -826,8 +826,6 @@ int smd_pkt_open(struct inode *inode, struct file *file)
}
D_STATUS("Begin %s on smd_pkt_dev id:%d\n", __func__, smd_pkt_devp->i);
file->private_data = smd_pkt_devp;
mutex_lock(&smd_pkt_devp->ch_lock);
if (smd_pkt_devp->ch == 0) {
wake_lock_init(&smd_pkt_devp->pa_wake_lock, WAKE_LOCK_SUSPEND,
......@@ -942,6 +940,8 @@ release_pd:
platform_driver_unregister(&smd_pkt_devp->driver);
smd_pkt_devp->driver.probe = NULL;
}
else if (r == 0)
file->private_data = smd_pkt_devp;
out:
if (!smd_pkt_devp->ch)
wake_lock_destroy(&smd_pkt_devp->pa_wake_lock);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment