From c838275ebad4165e34c2c6172c6ff0ffd839e9f0 Mon Sep 17 00:00:00 2001 From: Juan Gutierrez Date: Thu, 17 May 2012 12:53:34 -0500 Subject: 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 --- drivers/rpmsg/rpmsg_omx.c | 4 ++-- 1 file 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); -- cgit v1.2.3