|
@@ -27,11 +27,22 @@ static int ttyport_receive_buf(struct tty_port *port, const unsigned char *cp,
|
|
|
{
|
|
{
|
|
|
struct serdev_controller *ctrl = port->client_data;
|
|
struct serdev_controller *ctrl = port->client_data;
|
|
|
struct serport *serport = serdev_controller_get_drvdata(ctrl);
|
|
struct serport *serport = serdev_controller_get_drvdata(ctrl);
|
|
|
|
|
+ int ret;
|
|
|
|
|
|
|
|
if (!test_bit(SERPORT_ACTIVE, &serport->flags))
|
|
if (!test_bit(SERPORT_ACTIVE, &serport->flags))
|
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
|
|
- return serdev_controller_receive_buf(ctrl, cp, count);
|
|
|
|
|
|
|
+ ret = serdev_controller_receive_buf(ctrl, cp, count);
|
|
|
|
|
+
|
|
|
|
|
+ dev_WARN_ONCE(&ctrl->dev, ret < 0 || ret > count,
|
|
|
|
|
+ "receive_buf returns %d (count = %zu)\n",
|
|
|
|
|
+ ret, count);
|
|
|
|
|
+ if (ret < 0)
|
|
|
|
|
+ return 0;
|
|
|
|
|
+ else if (ret > count)
|
|
|
|
|
+ return count;
|
|
|
|
|
+
|
|
|
|
|
+ return ret;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static void ttyport_write_wakeup(struct tty_port *port)
|
|
static void ttyport_write_wakeup(struct tty_port *port)
|