Re: [PATCH v1 14/14] extcon: Use positive conditional in ternary operator

From: Andy Shevchenko
Date: Wed Apr 05 2023 - 04:18:29 EST


On Mon, Apr 03, 2023 at 11:38:41PM +0900, Chanwoo Choi wrote:
> On 23. 3. 22. 23:40, Andy Shevchenko wrote:
> > It's easier to parse by a human being the positive conditional.

...

> > const char *extcon_get_edev_name(struct extcon_dev *edev)
> > {
> > - return !edev ? NULL : edev->name;
> > + return edev ? edev->name : NULL;
> > }
> > EXPORT_SYMBOL_GPL(extcon_get_edev_name);
>
> It is not fix-up patch and I'm not sure that it is beneficial patch.
> I will not apply it.

It improves the cognitive perception of the code, but I'm fine with
no patch being applied.

--
With Best Regards,
Andy Shevchenko