Skip to content

Commit c8820c9

Browse files
dolciniij-intel
authored andcommitted
platform/surface: aggregator: fix recv_buf() return value
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: c167b9c ("platform/surface: Add Surface Aggregator subsystem") Cc: [email protected] Signed-off-by: Francesco Dolcini <[email protected]> Reviewed-by: Maximilian Luz <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Ilpo Järvinen <[email protected]> Signed-off-by: Ilpo Järvinen <[email protected]>
1 parent e0894ff commit c8820c9

File tree

1 file changed

+4
-1
lines changed
  • drivers/platform/surface/aggregator

1 file changed

+4
-1
lines changed

drivers/platform/surface/aggregator/core.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,12 @@ static int ssam_receive_buf(struct serdev_device *dev, const unsigned char *buf,
231231
size_t n)
232232
{
233233
struct ssam_controller *ctrl;
234+
int ret;
234235

235236
ctrl = serdev_device_get_drvdata(dev);
236-
return ssam_controller_receive_buf(ctrl, buf, n);
237+
ret = ssam_controller_receive_buf(ctrl, buf, n);
238+
239+
return ret < 0 ? 0 : ret;
237240
}
238241

239242
static void ssam_write_wakeup(struct serdev_device *dev)

0 commit comments

Comments
 (0)