drivers/rpmsg/clk/ioe: destroy nxsem properly

Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
chao an
2022-11-20 22:07:15 +08:00
committed by Xiang Xiao
parent 74cfa7ddb9
commit 07604b3220
2 changed files with 16 additions and 18 deletions
+8 -9
View File
@@ -485,18 +485,17 @@ static int64_t clk_rpmsg_sendrecv(FAR struct rpmsg_endpoint *ept,
cookie.result = -EIO; cookie.result = -EIO;
ret = rpmsg_send_nocopy(ept, msg, len); 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); nxsem_destroy(&cookie.sem);
if (ret < 0) return ret;
{
return ret;
}
return cookie.result;
} }
static bool clk_rpmsg_server_match(FAR struct rpmsg_device *rdev, static bool clk_rpmsg_server_match(FAR struct rpmsg_device *rdev,
+8 -9
View File
@@ -275,18 +275,17 @@ static int ioe_rpmsg_sendrecv(FAR struct rpmsg_endpoint *ept,
msg->cookie = (uintptr_t)&cookie; msg->cookie = (uintptr_t)&cookie;
ret = rpmsg_send(ept, msg, len); 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); nxsem_destroy(&cookie.sem);
if (ret < 0) return ret;
{
return ret;
}
return cookie.result;
} }
static int ioe_rpmsg_direction(FAR struct ioexpander_dev_s *dev, uint8_t pin, static int ioe_rpmsg_direction(FAR struct ioexpander_dev_s *dev, uint8_t pin,