From: Maximilian Luz <luzmaximilian@gmail.com>
To: "Francesco Dolcini" <francesco@dolcini.it>,
"Hans de Goede" <hdegoede@redhat.com>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Mark Gross" <markgross@kernel.org>
Cc: Francesco Dolcini <francesco.dolcini@toradex.com>,
platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v1] platform/surface: aggregator: fix recv_buf() return value
Date: Tue, 28 Nov 2023 21:13:37 +0100 [thread overview]
Message-ID: <944b641e-9351-40d1-89cb-82b448802aa1@gmail.com> (raw)
In-Reply-To: <20231128194935.11350-1-francesco@dolcini.it>
On 11/28/23 20:49, Francesco Dolcini wrote:
> From: Francesco Dolcini <francesco.dolcini@toradex.com>
>
> Serdev recv_buf() callback is supposed to return the amount of bytes
> consumed, therefore an int in between 0 and count.
>
> Do not return negative number in case of issue, when
> ssam_controller_receive_buf() returns ESHUTDOWN just returns 0, e.g. no
> bytes consumed, this keep the exact same behavior as it was before.
>
> This fixes a potential WARN in serdev-ttyport.c:ttyport_receive_buf().
>
> Cc: <stable@vger.kernel.org>
> Fixes: c167b9c7e3d6 ("platform/surface: Add Surface Aggregator subsystem")
> Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Thanks! Looks good to me.
Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com>
> ---
> drivers/platform/surface/aggregator/core.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/platform/surface/aggregator/core.c b/drivers/platform/surface/aggregator/core.c
> index 1a6373dea109..6152be38398c 100644
> --- a/drivers/platform/surface/aggregator/core.c
> +++ b/drivers/platform/surface/aggregator/core.c
> @@ -231,9 +231,12 @@ static int ssam_receive_buf(struct serdev_device *dev, const unsigned char *buf,
> size_t n)
> {
> struct ssam_controller *ctrl;
> + int ret;
>
> ctrl = serdev_device_get_drvdata(dev);
> - return ssam_controller_receive_buf(ctrl, buf, n);
> + ret = ssam_controller_receive_buf(ctrl, buf, n);
> +
> + return ret < 0 ? 0 : ret;
> }
>
> static void ssam_write_wakeup(struct serdev_device *dev)
next prev parent reply other threads:[~2023-11-28 20:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-28 19:49 Francesco Dolcini
2023-11-28 20:13 ` Maximilian Luz [this message]
2023-11-29 11:21 ` Ilpo Järvinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=944b641e-9351-40d1-89cb-82b448802aa1@gmail.com \
--to=luzmaximilian@gmail.com \
--cc=francesco.dolcini@toradex.com \
--cc=francesco@dolcini.it \
--cc=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=markgross@kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®