msm: smd_pkt: close the smd channel if open process times out
If the smd_pkt open process times out after smd_open returned success, call smd_close so that the end client can successfully attempt to open the smd_pkt device at a later time. If this is not done, smd_open will return an error code when the end client attempts a retry, causing smd and smd_pkt to get out of sync with regards to the state of the smd channel. Change-Id: I7169fb787f91a4ea7870872f9b1f1faeee2a1336 Signed-off-by: Jeffrey Hugo <jhugo@codeaurora.org>
This commit is contained in:
@@ -833,8 +833,12 @@ int smd_pkt_open(struct inode *inode, struct file *file)
|
||||
r = wait_event_interruptible_timeout(
|
||||
smd_pkt_devp->ch_opened_wait_queue,
|
||||
smd_pkt_devp->is_open, (2 * HZ));
|
||||
if (r == 0)
|
||||
if (r == 0) {
|
||||
r = -ETIMEDOUT;
|
||||
/* close the ch to sync smd's state with smd_pkt */
|
||||
smd_close(smd_pkt_devp->ch);
|
||||
smd_pkt_devp->ch = NULL;
|
||||
}
|
||||
|
||||
if (r < 0) {
|
||||
pr_err("%s: wait on smd_pkt_dev id:%d OPEN event failed"
|
||||
|
||||
Reference in New Issue
Block a user