lkml.org 
[lkml]   [2022]   [Dec]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v3 1/1] i2c: Set pinctrl recovery info to device pinctrl
Date
From


On 12/20/2022 9:18 PM, Andy Shevchenko wrote:
>> How you suggest to simplify this?
> Using Elvis operator, which is ?:.

Are you refer to use 'return dev->pins && dev->pins->p ?: NULL;' ?
Can't use Elvis operator in this way, because it will return the result
of 'dev->pins && dev->pins->p' and not the value of 'dev->pins->p'

>
>> I can use 'return dev->pins ? dev->pins->p ?: dev->pins->p : NULL;'
> Have you even try to compile this?
Yup, the code compiled, but i think the first suggestion is more readable.

>

\
 
 \ /
  Last update: 2023-03-26 23:16    [W:0.040 / U:0.268 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site