diff options
author | Juan Gutierrez <jgutierrez@ti.com> | 2012-05-17 12:53:34 -0500 |
---|---|---|
committer | Guillaume Aubertin <g-aubertin@ti.com> | 2012-06-26 12:20:44 +0200 |
commit | c838275ebad4165e34c2c6172c6ff0ffd839e9f0 (patch) | |
tree | 80cefe8c7681acc1a99743f152740e41dbf64ff6 | |
parent | 3d3c166a86f77a077c20087acd1c075ba252c2a9 (diff) |
rpmsg: omx: initialize completion event in rpmsg_omx_open
An omx object is created when opening the rpmsg-omx device. However
the "reply_arrived" completion event is not initialized until the
connection message is sent across.
When the rpmsg_omx driver is removed (like in recovery), all pending
threads waiting on the "reply_arrived" are unblocked by a complete_all
call, however, if the rpmsg-omx device was only opened, such event is
not initialized yet, so the complete_all call will dereference a null
object causing a panic.
This patch moves the initialization of the "reply_arrived" completion
event to the open call, after the allocation of the omx object.
Change-Id: Ia5ff93709ab5011cdfe0337173c286ad6d3ab209
Signed-off-by: Juan Gutierrez <jgutierrez@ti.com>
-rw-r--r-- | drivers/rpmsg/rpmsg_omx.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/rpmsg/rpmsg_omx.c b/drivers/rpmsg/rpmsg_omx.c index 737cdd7bb3a1..07c7c88b5eba 100644 --- a/drivers/rpmsg/rpmsg_omx.c +++ b/drivers/rpmsg/rpmsg_omx.c @@ -333,8 +333,6 @@ static int rpmsg_omx_connect(struct rpmsg_omx_instance *omx, char *omxname) payload = (struct omx_conn_req *)hdr->data; strcpy(payload->name, omxname); - init_completion(&omx->reply_arrived); - /* send a conn req to the remote OMX connection service. use * the new local address that was just allocated by ->open */ ret = rpmsg_send_offchannel(omxserv->rpdev, omx->ept->addr, @@ -477,6 +475,8 @@ static int rpmsg_omx_open(struct inode *inode, struct file *filp) "rpmsg-omx"); #endif + init_completion(&omx->reply_arrived); + /* associate filp with the new omx instance */ filp->private_data = omx; mutex_lock(&omxserv->lock); |