Re: [PATCH] tty: serdev: fix serdev_device_write return value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 2, 2017 at 12:25 PM, Johan Hovold <johan@xxxxxxxxxx> wrote:
> On Mon, May 01, 2017 at 07:17:14PM -0500, Rob Herring wrote:

>> -     return ret < 0 ? ret : (count ? -ETIMEDOUT : 0);
>> +     return ret < 0 ? ret : (count ? -ETIMEDOUT : wr_cnt);
>
> That's some nasty use of the ternary operator. Ditching it completely
> would be more readable.
>
>         if (ret < 0)
>                 return ret;
>
>         if (count)
>                 return -ETIMEDOUT;
>
>         return wr_count;


While I agree on the first part, I would go still with one ternary at the end:

            return count ? -ETIMEDOUT : wr_count;

-- 
With Best Regards,
Andy Shevchenko
--
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



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux