Re: [PATCH 1/1] rpmsg: char - treat `ENOMEM` as `EAGAIN`

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon 14 Feb 03:30 CST 2022, Tim Blechmann wrote:

> `rpmsg_trysend` returns `-ENOMEM` when no rpmsg buffer can be allocated.

Please use the form rpmsg_trysend() - without ``. You can omit that
around -ENOMEM as well.

> this causes `::write` to fail with this error as opposed to `-EAGAIN`.

Please drop the :: here as well.

> this is what user space applications (and libraries like boost.asio)
> would expect when using normal character devices.
> 
> Signed-off-by: Tim Blechmann <tim@xxxxxxxxxx>

I attempted to fix up the above details, but unfortunately your
Signed-off-by doesn't match your From:, so I can't apply the patch
anyways.

Can you please resubmit this with appropriate author/s-o-b?

> CC: Arnaud Pouliquen <arnaud.pouliquen@xxxxxxxxxxx>
> ---
>  drivers/rpmsg/rpmsg_char.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/rpmsg/rpmsg_char.c b/drivers/rpmsg/rpmsg_char.c
> index 5663cf799c95..5b9e708d595a 100644
> --- a/drivers/rpmsg/rpmsg_char.c
> +++ b/drivers/rpmsg/rpmsg_char.c
> @@ -239,14 +239,17 @@ static ssize_t rpmsg_eptdev_write_iter(struct kiocb *iocb,
>  
>  	if (!eptdev->ept) {
>  		ret = -EPIPE;
>  		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);
> +		if (ret == -ENOMEM)
> +			ret = -EAGAIN;
> +	}
>  	else
>  		ret = rpmsg_sendto(eptdev->ept, kbuf, len, eptdev->chinfo.dst);

./script/checkpatch.pl --strict tells me that you should have {} around
the else block as well..

Thanks,
Bjorn

>  
>  unlock_eptdev:
>  	mutex_unlock(&eptdev->ept_lock);
>  
> -- 
> 2.35.1
> 



[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux