Commit 7c11df42 authored by Thierry Escande's avatar Thierry Escande Committed by Greg Kroah-Hartman

misc: fastrpc: Fix device_open when no session is available

This change fixes fastrpc_device_open() when no session is available and
return an error in such case.
Signed-off-by: default avatarThierry Escande <thierry.escande@linaro.org>
Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c0fae22f
......@@ -1016,10 +1016,19 @@ static int fastrpc_device_open(struct inode *inode, struct file *filp)
INIT_LIST_HEAD(&fl->user);
fl->tgid = current->tgid;
fl->cctx = cctx;
fl->sctx = fastrpc_session_alloc(cctx);
if (!fl->sctx) {
dev_err(&cctx->rpdev->dev, "No session available\n");
mutex_destroy(&fl->mutex);
kfree(fl);
return -EBUSY;
}
spin_lock(&cctx->lock);
list_add_tail(&fl->user, &cctx->users);
spin_unlock(&cctx->lock);
fl->sctx = fastrpc_session_alloc(cctx);
return 0;
}
......
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