mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-25 11:55:37 +00:00
platform/surface: aggregator: fix recv_buf() return value
commitc8820c92ca
upstream. 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(). Fixes:c167b9c7e3
("platform/surface: Add Surface Aggregator subsystem") Cc: stable@vger.kernel.org Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com> Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com> Link: https://lore.kernel.org/r/20231128194935.11350-1-francesco@dolcini.it Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
bcd50a3bd6
commit
f5e6958919
1 changed files with 4 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue