On Fri, Mar 31, 2017 at 9:35 AM, Andy Shevchenko <andy.shevchenko@xxxxxxxxx> wrote: > On Fri, Mar 31, 2017 at 4:22 PM, Rob Herring <robh@xxxxxxxxxx> wrote: >> On Thu, Mar 30, 2017 at 5:00 PM, Andrey Smirnov >> <andrew.smirnov@xxxxxxxxx> wrote: > >>> +int serdev_device_write(struct serdev_device *serdev, >>> + const unsigned char *buf, size_t count, >>> + unsigned long timeout) >>> { >>> struct serdev_controller *ctrl = serdev->ctrl; >>> + int ret; >>> >>> + if (!ctrl || !ctrl->ops->write_buf || >>> + (timeout && !serdev->ops->write_wakeup)) >>> return -EINVAL; >>> >>> + mutex_lock(&serdev->write_lock); >>> + do { >>> + reinit_completion(&serdev->write_comp); >>> + >>> + ret = ctrl->ops->write_buf(ctrl, buf, count); >>> + if (ret < 0) >>> + break; >>> + >>> + buf += ret; >>> + count -= ret; >>> + >>> + } while (count && >>> + (timeout = wait_for_completion_timeout(&serdev->write_comp, >>> + timeout))); >> >> Need to test for timeout < 0 here and return timeout when < 0. > > It can't be the case since the variable is of unsigned type. Oh right, that's only the interruptible version. NM Reviewed-by: Rob Herring <robh@xxxxxxxxxx> Rob -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html