[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Y6M7WEMwSSndugE3@smile.fi.intel.com>
Date: Wed, 21 Dec 2022 18:59:04 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: "Hawa, Hanna" <hhhawa@...zon.com>
Cc: wsa@...nel.org, linus.walleij@...aro.org,
linux-i2c@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-gpio@...r.kernel.org, dwmw@...zon.co.uk, benh@...zon.com,
ronenk@...zon.com, talel@...zon.com, jonnyc@...zon.com,
hanochu@...zon.com, farbere@...zon.com, itamark@...zon.com
Subject: Re: [PATCH v3 1/1] i2c: Set pinctrl recovery info to device pinctrl
On Tue, Dec 20, 2022 at 09:32:11PM +0200, Hawa, Hanna wrote:
> 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 see now. Then we need to check pins separately, something like
if (!dev->pins)
return NULL;
return dev->pins->p;
Sorry that I haven't noticed that before.
> > > 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.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists