drivers/rpmsg/clk/ioe: destroy nxsem properly
Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
parent
74cfa7ddb9
commit
07604b3220
@ -485,18 +485,17 @@ static int64_t clk_rpmsg_sendrecv(FAR struct rpmsg_endpoint *ept,
|
||||
cookie.result = -EIO;
|
||||
|
||||
ret = rpmsg_send_nocopy(ept, msg, len);
|
||||
if (ret < 0)
|
||||
if (ret >= 0)
|
||||
{
|
||||
return ret;
|
||||
ret = nxsem_wait_uninterruptible(&cookie.sem);
|
||||
if (ret >= 0)
|
||||
{
|
||||
ret = cookie.result;
|
||||
}
|
||||
}
|
||||
|
||||
ret = nxsem_wait_uninterruptible(&cookie.sem);
|
||||
if (ret < 0)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
return cookie.result;
|
||||
nxsem_destroy(&cookie.sem);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bool clk_rpmsg_server_match(FAR struct rpmsg_device *rdev,
|
||||
|
@ -275,18 +275,17 @@ static int ioe_rpmsg_sendrecv(FAR struct rpmsg_endpoint *ept,
|
||||
msg->cookie = (uintptr_t)&cookie;
|
||||
|
||||
ret = rpmsg_send(ept, msg, len);
|
||||
if (ret < 0)
|
||||
if (ret >= 0)
|
||||
{
|
||||
return ret;
|
||||
ret = rpmsg_wait(ept, &cookie.sem);
|
||||
if (ret >= 0)
|
||||
{
|
||||
ret = cookie.result;
|
||||
}
|
||||
}
|
||||
|
||||
ret = rpmsg_wait(ept, &cookie.sem);
|
||||
if (ret < 0)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
return cookie.result;
|
||||
nxsem_destroy(&cookie.sem);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int ioe_rpmsg_direction(FAR struct ioexpander_dev_s *dev, uint8_t pin,
|
||||
|
Loading…
Reference in New Issue
Block a user