Skip to content

Commit cbf5825

Browse files
timblechmannandersson
authored andcommitted
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: Tim Blechmann <tim@klingt.org> Cc: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20220313024541.1579848-2-tim@klingt.org
1 parent db64e7e commit cbf5825

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/rpmsg/rpmsg_char.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,13 @@ static ssize_t rpmsg_eptdev_write_iter(struct kiocb *iocb,
242242
goto unlock_eptdev;
243243
}
244244

245-
if (filp->f_flags & O_NONBLOCK)
245+
if (filp->f_flags & O_NONBLOCK) {
246246
ret = rpmsg_trysendto(eptdev->ept, kbuf, len, eptdev->chinfo.dst);
247-
else
247+
if (ret == -ENOMEM)
248+
ret = -EAGAIN;
249+
} else {
248250
ret = rpmsg_sendto(eptdev->ept, kbuf, len, eptdev->chinfo.dst);
251+
}
249252

250253
unlock_eptdev:
251254
mutex_unlock(&eptdev->ept_lock);

0 commit comments

Comments
 (0)