提交 cbf58250 编写于 作者: T Tim Blechmann 提交者: Bjorn Andersson

rpmsg: char: treat rpmsg_trysend() ENOMEM as EAGAIN

rpmsg_trysend() returns -ENOMEM when no rpmsg buffer can be allocated.
this causes write to fail with this error as opposed to -EAGAIN.
this is what user space applications (and libraries like boost.asio)
would expect when using normal character devices.
Signed-off-by: NTim Blechmann <tim@klingt.org>
Cc: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
Signed-off-by: NBjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220313024541.1579848-2-tim@klingt.org
上级 db64e7e7
...@@ -242,10 +242,13 @@ static ssize_t rpmsg_eptdev_write_iter(struct kiocb *iocb, ...@@ -242,10 +242,13 @@ static ssize_t rpmsg_eptdev_write_iter(struct kiocb *iocb,
goto unlock_eptdev; goto unlock_eptdev;
} }
if (filp->f_flags & O_NONBLOCK) if (filp->f_flags & O_NONBLOCK) {
ret = rpmsg_trysendto(eptdev->ept, kbuf, len, eptdev->chinfo.dst); ret = rpmsg_trysendto(eptdev->ept, kbuf, len, eptdev->chinfo.dst);
else if (ret == -ENOMEM)
ret = -EAGAIN;
} else {
ret = rpmsg_sendto(eptdev->ept, kbuf, len, eptdev->chinfo.dst); ret = rpmsg_sendto(eptdev->ept, kbuf, len, eptdev->chinfo.dst);
}
unlock_eptdev: unlock_eptdev:
mutex_unlock(&eptdev->ept_lock); mutex_unlock(&eptdev->ept_lock);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册