Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1614076

Re: [PATCH v3] serdev: Add serdev_device_write subroutine

From Andy Shevchenko <andy.shevchenko@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH v3] serdev: Add serdev_device_write subroutine
Date 2017-03-31 16:40 +0200
Message-ID <tr5Sy-5OH-7@gated-at.bofh.it> (permalink)
References <tqQqt-4p3-11@gated-at.bofh.it> <tr4MO-59K-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Mar 31, 2017 at 4:22 PM, Rob Herring <robh@kernel.org> wrote:
> On Thu, Mar 30, 2017 at 5:00 PM, Andrey Smirnov
> <andrew.smirnov@gmail.com> 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.

-- 
With Best Regards,
Andy Shevchenko

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3] serdev: Add serdev_device_write subroutine Andrey Smirnov <andrew.smirnov@gmail.com> - 2017-03-31 00:10 +0200
  Re: [PATCH v3] serdev: Add serdev_device_write subroutine Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-03-31 13:50 +0200
  Re: [PATCH v3] serdev: Add serdev_device_write subroutine Rob Herring <robh@kernel.org> - 2017-03-31 15:30 +0200
    Re: [PATCH v3] serdev: Add serdev_device_write subroutine Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-03-31 16:40 +0200
      Re: [PATCH v3] serdev: Add serdev_device_write subroutine Rob Herring <robh@kernel.org> - 2017-03-31 18:40 +0200

csiph-web