[PATCH 05/14] nvmet: get rid of the extra variable

Logan Gunthorpe logang at deltatee.com
Mon Aug 10 19:32:19 EDT 2020



On 2020-08-10 5:13 p.m., Keith Busch wrote:
> On Mon, Aug 10, 2020 at 11:00:55PM +0000, Chaitanya Kulkarni wrote:
>> On 8/10/20 14:58, Logan Gunthorpe wrote:
>>> IMO, that's really ugly and not at all an improvement.
>>>
>>> Logan
>>
>> && operator is perfectly readable when use for short circuit two 
>> conditions, more than 2 or newline is what ugly not this one.
> 
> The odd looking part is mixing "likely()" and "unlikely()" in the same
> conditional.
> 

Yes. Also, I've found kernel developers generally prefer functions with
long imperative names to not be used directly in an if statement. Just
search for 'if (ret)' in host/core.c to see many examples that could be
folded into the if statement, when they are not. Only functions with
names that are predicates, or answer questions, may be used in if
statements.

Logan



More information about the Linux-nvme mailing list